Question

W3 Total Cache with Nginx.

I get this Nginx related error when installing W3 Total Cache Plugin:

FTP credentials don’t allow to write to file /var/www/nginx.conf

W3 Total Cache Error: Files and directories could not be automatically created to complete the installation.

Please execute commands manually

BEGIN W3TC Browser Cache

gzip on; gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

END W3TC Browser Cache

I don’t mind executing the commands manually but the nginx.conf file is not located where W3TC thinks it should be. The file is located at /etc/nginx/nginx.conf. but when I try to copy and paste it in the directory W3TC wants it to be in, I get errors from filezilla saying “open for write: Permission Denied.” so the file refuses to copy to the directory W3 Total Cache wants to make it work.

Any help is very welcome.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Security plugins like iThemes Security or Bulletproof Security may hinder the default file permission. Even other plugins lost their writing permission to .htaccess (for Apache) and nginx.conf (for Nginx). Even you could not see the image which was recently uploaded.

The solution is simple.

  1. Check the directory permission level is 755 (in case WordPress installed in the directory).
  2. Now check the file permission for .htaccess or nginx.conf which is necessary to be 644 Otherwise, you will encounter the error.

You can use FileZilla or cPanel to change file permission level.

Source: DoubtSolver

Ok, this is how I fixed it (same as sunaytamashev explained): <br> <br>1. Copied ‘nginx.conf’ from ‘/etc/nginx’ to ‘/var/www’ and then added the W3 Total Cache code manualy. <br>Refresh, and the error was gone.

I would like some details on the FIX too.