Last active
November 11, 2016 19:18
-
-
Save fabiomontefuscolo/b627352f615cde10c5c1997a0b022008 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 /var/cache/nginx levels=1:2 keys_zone=php_cache:100m inactive=1d; | |
fastcgi_cache_key "$scheme://$host$request_uri"; | |
server { | |
listen 80; | |
server_name montefuscolo.com.br www.montefuscolo.com.br; | |
return 301 https://montefuscolo.com.br$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name montefuscolo.com.br www.montefuscolo.com.br montefuscolo.com.br; | |
ssl_certificate /etc/letsencrypt/live/montefuscolo.com.br/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/montefuscolo.com.br/privkey.pem; | |
access_log /var/log/nginx/montefuscolo.com.br.access.log; | |
error_log /var/log/nginx/montefuscolo.com.br.error.log; | |
gzip on; | |
gzip_disable "msie6"; | |
gzip_min_length 1100; | |
gzip_buffers 16 8k; | |
gzip_types | |
text/plain | |
text/css | |
text/js | |
text/javascript | |
application/javascript | |
application/x-javascript | |
application/json; | |
client_max_body_size 50m; | |
root /var/www/montefuscolo.com.br/src; | |
index index.php index.html; | |
set $no_cache 0; | |
if ($request_uri ~* "/wp-admin") { set $no_cache 1; } | |
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { set $no_cache 1; } | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
return 200 "User-agent: *\nDisallow: /wp-admin"; | |
} | |
location ^~ /xmlrpc.php { | |
deny all; | |
} | |
location ^~ /wp-content/uploads/ { | |
expires max; | |
} | |
location ^~ /status/ { | |
stub_status on; | |
allow 127.0.0.1; | |
deny all; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
include fastcgi.conf; | |
fastcgi_pass_header "X-Accel-Redirect"; | |
fastcgi_pass_header "X-Accel-Expires"; | |
## | |
## Sometime you need to force | |
## | |
#fastcgi_hide_header "Set-Cookie"; | |
#fastcgi_ignore_headers "Cache-Control" "Expires" "Set-Cookie"; | |
fastcgi_cache php_cache; | |
fastcgi_cache_valid 200 60m; | |
fastcgi_cache_bypass $no_cache; | |
fastcgi_no_cache $no_cache; | |
fastcgi_cache_use_stale error timeout http_500 http_503; | |
add_header X-Cache $upstream_cache_status; | |
fastcgi_pass unix:/run/php5-fpm.sock; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found on; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment