Created
July 17, 2017 09:22
-
-
Save VirtuBox/a8781a7cf53a9a72447cac5acec11b1c to your computer and use it in GitHub Desktop.
WordPress Additionals directives for Nginx only with Plesk onyx
This file contains hidden or 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
if (!-e $request_filename){ | |
rewrite ^(.*)$ /index.php break; | |
} | |
# 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; | |
# log_not_found off; | |
# add_header Pragma public; | |
# add_header Cache-Control "public"; | |
#} | |
# CSS and Javascript | |
#location ~* \.(?:css|js)$ { | |
# expires 1y; | |
# access_log off; | |
# log_not_found off; | |
# add_header Pragma public; | |
# add_header Cache-Control "public"; | |
#} | |
# Yoast sitemap | |
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ { | |
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent; | |
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last; | |
# Rules for yoast sitemap with wp|wpsubdir|wpsubdomain | |
rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last; | |
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; | |
# Following lines are options. Needed for WordPress seo addons | |
rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last; | |
rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last; | |
rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last; | |
rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last; | |
access_log off; | |
} | |
# Cache static files | |
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ { | |
add_header "Access-Control-Allow-Origin" "*"; | |
access_log off; | |
log_not_found off; | |
#expires max; | |
expires 30d; | |
add_header Cache-Control "public"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently I've the problem that wprocket is not caching, with
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
the caching of wprocket works but it somehow breaks the file system. If a customer try's to download a file from his account it downloads an empty broken file. The werid thing is the products doesn't work at all, it breaks .mp4 files and zip files which are uploaded for the products.