Created
August 20, 2013 20:17
-
-
Save chriswallace/6286698 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Global restrictions configuration file. | |
# Designed to be included in any server {} block.</p> | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). | |
location ~ /\. { | |
deny all; | |
access_log off; | |
log_not_found off; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN W3TC CDN | |
location ~ \.(ttf|otf|eot|woff)$ { | |
add_header Access-Control-Allow-Origin "*"; | |
} | |
# END W3TC CDN | |
# BEGIN W3TC Browser Cache | |
gzip on; | |
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; | |
location ~ \.(css|htc|js|js2|js3|js4)$ { | |
add_header X-Powered-By "W3 Total Cache/0.9.2.11"; | |
} | |
location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ { | |
add_header X-Powered-By "W3 Total Cache/0.9.2.11"; | |
} | |
location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ { | |
add_header X-Powered-By "W3 Total Cache/0.9.2.11"; | |
} | |
# END W3TC Browser Cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WordPress multisite subdirectory rules. | |
# Designed to be included in any server {} block. | |
# Add trailing slash to */wp-admin requests. | |
rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
# Directives to send expires headers and turn off 404 error logging. | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 24h; | |
log_not_found off; | |
} | |
# Pass uploaded files to wp-includes/ms-files.php. | |
rewrite /files/$ /index.php last; | |
# For multisite: Use a caching plugin/script that creates symlinks to the correct subdirectory structure to get some performa$ | |
set $cachetest "$document_root/wp-content/cache/ms-filemap/${host}${uri}"; | |
if ($uri ~ /$) { | |
set $cachetest ""; | |
} | |
if (-f $cachetest) { | |
# Rewrites the URI and stops rewrite processing so it doesn't start over and attempt to pass it to the next rule. | |
rewrite ^ /wp-content/cache/ms-filemap/${host}${uri} break; | |
} | |
if ($uri !~ wp-content/plugins) { | |
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last; | |
} | |
# Uncomment one of the lines below for the appropriate caching plugin (if used). | |
# include global/wordpress-ms-subdir-wp-super-cache.conf; | |
include global/wordpress-ms-subdir-w3-total-cache.conf; | |
# Rewrite multisite '.../wp-.*' and '.../*.php'. | |
if (!-e $request_filename) { | |
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last; | |
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last; | |
} | |
# Pass all .php files onto a php-fpm/php-fcgi server. | |
location ~ \.php$ { | |
# Zero-day exploit defense. | |
# http://forum.nginx.org/read.php?2,88845,page=3 | |
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/ph$ | |
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers tha$ | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
include fastcgi_params; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# fastcgi_intercept_errors on; | |
fastcgi_pass php; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; | |
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name www.domain.com; | |
rewrite ^(.*) http://domain.com$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name domain.com; | |
root /var/www; | |
client_max_body_size 30M; | |
location / { | |
root /www; | |
index index.php index.html index.htm; | |
try_files $uri $uri/ /index.php?$args; | |
include global/wordpress-seo-by-yoast.conf; | |
} | |
include global/restrictions.conf; | |
include global/wordpress-ms-subdir.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment