Ready to get started?Download WordPress


W3 Total Cache
[resolved] Proper integration with nginx.conf (6 posts)

  1. 72strokes
    Posted 3 years ago #

    I'm using the development version ( of W3 Total Cache due to the nginx support. It seems to be working well despite some self-induced APC issues.

    My main question is proper use of the nginx.conf file in my public root folder. I've set up my server as per the standard ubuntu nginx configuration of using a master nginx file in /usr/local/nginx/conf/nginx.conf and a domain specific configuration in /usr/local/nginx/sites-enabled/* (symlinked to sites-available). What I'm not sure about is how all of this interacts (or doesn't) with the nginx.conf that W3TC creates in my public folder.

    Should I be manually adding the nginx rewrite rules to my domain specific config file? Or is there some better way to handle this? Thanks for the advice!

  2. 72strokes
    Posted 3 years ago #

    Just FYI, I added the following line to my domain specific nginx config file inside the location block:

    include /path.to.nginx.conf

    That seemed to do the trick. I'm still having some other problems regarding disk enhanced page caching but expire headers, disk (basic) caching, and opcode caching all work correctly.

  3. Ovidiu
    Posted 2 years ago #

    same question here: by coincidence I just found a nginx.conf file in my root which seems to have been generated by w3 total cache.

    this wasn't mentioned anywhere!

    there I was wondering what was missing :-(
    this really should make it into the FAQ: include your nginx.conf file from root into the main nginx config file :-(

  4. odie5533
    Posted 2 years ago #

    I have my main nginx site configurations in /etc/nginx/sites-available. These are all owned by root. Then I let w3tc store its settings wherever it wants to, in this case it likes to store them in /var/www/sitename.com/nginx.conf. Then I add the following within the server brackets of my nginx site config (/etc/nginx/sites-available/sitename.com):

    location ~ /nginx.conf {
                    deny all;

    This blocks people from reading w3tc's nginx.conf. The rest of my configuration is set up according to http://codex.wordpress.org/Nginx.

  5. There is a field under the general settings tab that asks for the location of the nginx.conf file to write to. If this is left blank it will write the file in your root dir.

    With so many different Nginx vhosts and conf configurations out there it's impossible for W3 to know which file to write to. Also note that Nginx has to be restarted for the new settings to take effect.

  6. Ovidiu
    Posted 2 years ago #

    thanks for clarifying. I got it sorted, its just that I didn't notice that settings field to specify a path...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic