Skip to content

Custom Nginx WordPress VirtualHost template with Nginx fastcgi_cache for Plesk Onyx

License

Notifications You must be signed in to change notification settings

eleshar/plesk-nginx-fascgi-cache-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Fastcgi_cache custom template for Plesk Onyx

Features

  • 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 ..)

Requirements

  • 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

Limitations

  • Custom rules to bypass cache set in Plesk are not applied
  • fastcgi_cache template work only for wordpress

How to use this template

  1. Clone the repository
git clone https://github.com/VirtuBox/plesk-nginx-fascgi-cache-template.git /usr/local/psa/admin/conf/templates/custom
  1. Copy Nginx configuration in Nginx conf.d directory
cp -f /usr/local/psa/admin/conf/templates/custom/nginx-conf/* /etc/nginx/conf.d/
  1. Reload nginx
nginx -t && service nginx reload
  1. 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
  1. Disable Proxy mode in Plesk > Yourdomain.tld > Apache & nginx Settings

  2. Enable Nginx cache in Plesk > Yourdomain.tld > Apache & nginx Settings

  3. Login into WordPress & install Nginx-helper plugin

  4. In Nginx-helper Settings, Enable Purge

How to update this template

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

About

Custom Nginx WordPress VirtualHost template with Nginx fastcgi_cache for Plesk Onyx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%