- Override default Nginx virtualhost template to work with WordPress in mode "Nginx Only"
- set fastcgi_cache bypass rules globally on the server using the directive map instead of several "if".
- add support for Nginx fastcgi_cache purge with Nginx-helper
- Bypass cache on cookies or request_uri
- add webp image rewrite support
- Deny access to hidden files and directory (.git, .htaccess, etc ..)
- Nginx compiled with Nginx_cache_purge module : You can use nginx-ee to compile Nginx
Custom template compatible with stock Nginx package shipped by Plesk, available here : nginx-stock
- Custom rules to bypass cache set in Plesk are not applied
- fastcgi_cache template work only for wordpress
- Clone the repository
git clone https://github.com/rikzwarthoff/plesk-nginx-config.git /usr/local/psa/admin/conf/templates/custom
- Copy Nginx configuration in Nginx conf.d directory
cp -f /usr/local/psa/admin/conf/templates/custom/nginx-conf/* /etc/nginx/conf.d/
- Reload nginx
nginx -t && service nginx reload
- Apply new nginx virtualhost template
# let plesk detect custom template
plesk repair web -n
# rebuild vhost with custom template
plesk repair web -y -domains-only
-
Disable Proxy mode in Plesk > Yourdomain.tld > Apache & nginx Settings
-
Enable Nginx cache in Plesk > Yourdomain.tld > Apache & nginx Settings
-
Login into WordPress & install Nginx-helper plugin
-
In Nginx-helper Settings, Enable Purge
Just run :
git -C /usr/local/psa/admin/conf/templates/custom pull origin master
And relaunch plesk repair web to apply changes :
# let plesk detect custom template
plesk repair web -n
# rebuild vhost with custom template
plesk repair web -y -domains-only