-
-
Save chrisvanpatten/5d639b7d6f2de8c87137 to your computer and use it in GitHub Desktop.
This file contains 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
# Rendered: Mon Sep 22 12:58:55 UTC 2014 | |
server { | |
################################## | |
# # | |
# Default settings # | |
# # | |
################################## | |
# Error Logging | |
error_log /var/log/nginx/error.log notice; | |
# rewrite_log on; | |
# Set the port | |
listen 8080; | |
# Where are we located? What should we load by default? | |
root /home/site/dev.site.com/current/public; | |
index index.php index.html index.htm; | |
# What's our domain name? | |
server_name dev.site.com; | |
# Avoid sendfile issues with sending stale files | |
# More: <http://www.vanpattenmedia.com/2012/a-tale-of-stale-content/> | |
sendfile off; | |
################################## | |
# # | |
# Rewrites and asset caching # | |
# # | |
################################## | |
rewrite ^/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) /wp/$2 break; | |
rewrite ^/([_0-9a-zA-Z-]+/)?(.*\.php)$ /wp/$2 break; | |
location / { | |
try_files $uri $uri/ @rewrites; | |
} | |
location @rewrites { | |
# redirect wp-content to content | |
rewrite ^/wp-content/(.*)$ /content/$1 permanent; | |
# If nothing matches, send it to index.php | |
rewrite ^ /index.php last; | |
} | |
################### | |
# Error handling # | |
################### | |
# Don't log when robots or favicon is accessed or 404'd | |
location = /favicon.ico { access_log off; log_not_found off; } | |
# Prevents dotfiles from being served | |
location ~ /\. { access_log off; log_not_found off; deny all; } | |
# Disable execution of PHP from uploads folder | |
location ~* /content/uploads/.*\.php$ { | |
return 403; | |
} | |
################################## | |
# # | |
# PHP-related settings # | |
# # | |
################################## | |
# these are now server-global, so our 'internal'-only PHP scripts (TimThumb) can inherit the settings | |
# in their location blocks | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# for Chroot # fastcgi_param SCRIPT_FILENAME /vanpattenmedia.com/$fastcgi_script_name; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param DOCUMENT_ROOT $document_root; | |
fastcgi_param SERVER_PROTOCOL $server_protocol; | |
fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
fastcgi_param SERVER_SOFTWARE nginx; | |
fastcgi_param REMOTE_ADDR $remote_addr; | |
fastcgi_param REMOTE_PORT $remote_port; | |
fastcgi_param SERVER_ADDR $server_addr; | |
fastcgi_param SERVER_PORT 80; | |
fastcgi_param SERVER_NAME $server_name; | |
location ~ \.php { | |
# prevent accidental PHP execution of non-PHP extensions | |
# see http://wiki.nginx.org/Pitfalls | |
try_files $uri =404; | |
location ~ \..*/.*\.php$ { | |
return 404; | |
} | |
fastcgi_pass unix:/var/run/php5-fpm-pools-site.sock; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment