How do I add the smartcacheopt.conf file to my NGINX configuration?

May 17, 2018

Attention: This information is provided for general knowledge.  We do not take responsibility for problems that may arise from its use.  If you are not comfortable changing server settings, please ask your system administrator.

The smartcacheopt.conf file contains several optimization instructions, automatically prepared by SmartCache and executed by the server, that help to maximize your site’s performance outside of WordPress.  However, on NGINX servers, this file is ineffective until it is included in either the default or domain configuration file.

If you log into your server using SSH and open the default (/etc/nginx/sites-available/default) or domain configuration file (/etc/nginx/sites-available/{domainname}) in a text editor such as VIM or NANO, simply insert the following line before the .php location block:

include /var/www/{domainname}/{docroot}/smartcacheopt.conf;

Then save the file and run nginx -t to verify the changes.  If everything works, restart your server.

Please follow and like us: