Created
August 5, 2016 21:02
-
-
Save VirtuBox/632ca4a67dfdd3e4d97f9dd0c1d1d3b6 to your computer and use it in GitHub Desktop.
WordPress optimized settings for Nginx
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
gzip on; | |
gzip_comp_level 6; | |
gzip_http_version 1.0; | |
gzip_proxied any; | |
gzip_min_length 1100; | |
gzip_buffers 16 8k; | |
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
gzip_disable "MSIE [1-6].(?!.*SV1)"; | |
gzip_vary on; | |
add_header X-Frame-Options "SAMEORIGIN" always; | |
add_header X-Content-Type-Options nosniff; | |
add_header X-XSS-Protection "1; mode=block"; | |
# cache.appcache, your document html and data | |
location ~* \.(?:manifest|appcache|html?|xml|json)$ { | |
expires -1; | |
} | |
location ~* \.(?:rss|atom)$ { | |
expires 1h; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:css|js|txt)$ { | |
expires 1y; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
add_header Cache-Control "public"; | |
} | |
#Media: images, icons, video, audio, HTC | |
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { | |
expires 1M; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { | |
expires 1M; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
add_header Cache-Control "public"; | |
} | |
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; | |
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment