Created
November 9, 2013 10:37
-
-
Save philcrump/7384154 to your computer and use it in GitHub Desktop.
Wordpress Nginx Config
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
server { | |
listen 80; | |
listen [::]:80; | |
server_name dottyprojects.com; | |
rewrite ^(.*) http://www.dottyprojects.com permanent; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name www.dottyprojects.com; | |
server_name www.dottyprojects.com; | |
access_log /var/log/nginx/dottyprojects.com/access.log; | |
#access_log off; | |
error_log /var/log/nginx/dottyprojects.com/error.log; | |
root /srv/dottyprojects.com; | |
index index.php index.html; | |
set $cache_uri $request_uri; | |
if ($request_method = POST) { | |
set $cache_uri 'null cache'; | |
} | |
if ($query_string != "") { | |
set $cache_uri 'null cache'; | |
} | |
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { | |
set $cache_uri 'null cache'; | |
} | |
# Don't use the cache for logged in users or recent commenters | |
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { | |
set $cache_uri 'null cache'; | |
} | |
# Use cached or actual file if they exists, otherwise pass request to WordPress | |
location / { | |
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args ; | |
} | |
location ~ \.php?$ { | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment