W3 total cache error

April 17, 2014 6.2k views
I have installed wordpress using this guide https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04 Now site working fine but I am facing errors when I try to install W3 total cache. ------------------ I get the following error: 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 or use FTP form to allow W3 Total Cache make it automatically. ------------------------------- I have installed FTP using this guide https://www.digitalocean.com/community/articles/how-to-set-up-vsftpd-on-ubuntu-12-04 thanks ---------------------- Please help.I am confused
12 Answers
uninstall ftp
log into your droplet using ssh

$ sudo touch /var/www/nginx.conf
$ sudo chown www-data /var/www/nginx.conf

The second line assumes php-fpm is running as user www-data, which I think it does by default on ubuntu

you'll also need to edit you nginx config and include that file inside your server block
Sorry, these may be stupid questions but I just don't want to mess things up.

What command should I use to uninstall ftp?
Which file should I include inside server block?
How to edit nginx cofig?

sudo apt-get remove vsftpd

you need to include /var/www/nginx.conf inside your server block in /etc/nginx/sites-enabled/wordpress

sudo nano /etc/nginx/sites-available/wordpress

after the

location ~ \.php$ {

block, add a line

include /var/www/nginx.conf ;

then there should be your closing server brace already in the file


I did as you said. After that no changes occured so I thought of restarting nginx and I got this error

sudo service nginx restart
Restarting nginx: nginx: [emerg] open() "/var/www/nginx.conf" failed (2: No such file or directory) in /etc/nginx/sites-enabled/wordpress:66
nginx: configuration file /etc/nginx/nginx.conf test failed

Now whole site is down.

Oops! Google Chrome could not connect to

Please help
Now Nginx is running when I removed the line include /var/www/nginx.conf ;

you were suppose to create /var/www/nginx.conf like I said in my first message
Really Thanks man.
I guess its working.W3 total cache not showing any errors.
However when I open /var/www/nginx.conf this file shows blank.
What should I edit in this file? Do I need to add something?
And at last should I restart nginx?
it gets written to when you update or save w3 settings, assuming php-fpm has write access to it.
How to know if php-fpm has write access? I used this commands.

$ sudo touch /var/www/nginx.conf
$ sudo chown www-data /var/www/nginx.conf

Anyways when I change w3 settings everything is working fine.

So, should I consider everything is successful.
Try using 'easyengine', it will automate the process of installing and configuring Nginx + PHP-FPM + MySQL + Postfix + WordPress + W3TC + many more options
@ajinkyathete: Once you update it, make sure you change its ownership back to root:
sudo chown root /var/www/nginx.conf

.htaccess File Permission Error
Due to the security plugins, other plugins lost their writing permission to .htaccess and other files. 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 which is necessary to be 644. Otherwise, you will encounter the error.

Source: DoubtSolver

Have another answer? Share your knowledge.