-
-
Save vqiu/29365d8174de648d4fcc57f112bf30b0 to your computer and use it in GitHub Desktop.
Hosting WordPress Yourself Part 7
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
fastcgi_cache_path /home/ashley/ashleyrich.com/cache levels=1:2 keys_zone=ashleyrich.com:100m inactive=60m; | |
fastcgi_cache_key “$scheme$request_method$host$request_uri”; | |
server { | |
listen 80; | |
server_name pluto.ashleyrich.com; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl spdy; | |
server_name pluto.ashleyrich.com; | |
ssl_certificate /etc/ssl/pluto.ashleyrich.com.crt; | |
ssl_certificate_key /etc/ssl/pluto.key; | |
access_log /home/ashley/ashleyrich.com/logs/access.log; | |
error_log /home/ashley/ashleyrich.com/logs/error.log; | |
root /home/ashley/ashleyrich.com/public/; | |
index index.php; | |
set $skip_cache 0; | |
# POST requests and urls with a query string should always go to PHP | |
if ($request_method = POST) { | |
set $skip_cache 1; | |
} | |
if ($query_string != "") { | |
set $skip_cache 1; | |
} | |
# Don't cache uris containing the following segments | |
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") { | |
set $skip_cache 1; | |
} | |
# Don't use the cache for logged in users or recent commenters | |
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { | |
set $skip_cache 1; | |
} | |
# Don't cache shopping basket, checkout or account pages | |
if ($request_uri ~* "/cart/*$|/checkout/*$|/my-account/*$") { | |
set $skip_cache 1; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_cache_bypass $skip_cache; | |
fastcgi_no_cache $skip_cache; | |
fastcgi_cache ashleyrich.com; | |
fastcgi_cache_valid 60m; | |
} | |
location ~ /purge(/.*) { | |
fastcgi_cache_purge ashleyrich.com "$scheme$request_method$host$1"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment