-
-
Save ybart/5434931 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
fastcgi_cache_path /tmp/nginx-cache levels=1:2 keys_zone=wordpress:20m inactive=1d max_size=512M; | |
upstream php-fpm { | |
server localhost:9000; | |
} | |
server { | |
listen 1.2.3.4:80; | |
listen [1:2:3:4::5]:80; | |
server_name blog.example.com | |
root /home/wordpress/wordpress; | |
index index.php; | |
charset UTF-8; | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_vary on; | |
gzip_comp_level 6; | |
gzip_proxied any; | |
gzip_types text/plain text/xml text/css application/x-javascript; | |
access_log /var/log/nginx/example.com.access.log; | |
error_log /var/log/nginx/example.com.error.log; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?q=$uri&$args; | |
} | |
location ~ \.php$ { | |
set $nocache ""; | |
if ($http_cookie ~ (comment_author_.*|wordpress_logged_in.*|wp-postpass_.*)) { | |
set $nocache "Y"; | |
} | |
fastcgi_pass php-fpm; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /home/wordpress/wordpress$fastcgi_script_name; | |
fastcgi_intercept_errors on; | |
include fastcgi_params; | |
fastcgi_cache_use_stale error timeout invalid_header http_500; | |
fastcgi_cache_key $host$request_uri; | |
fastcgi_cache wordpress; | |
fastcgi_cache_valid 200 1m; | |
fastcgi_cache_bypass $nocache; | |
fastcgi_no_cache $nocache; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
location ~ ^/(status|ping)$ { | |
include /etc/nginx/fastcgi_params; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; | |
allow 127.0.0.1; | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment