Question

How can i configure w3 total cache, fastCGI, and optimize nginx for best performance on Ubuntu 14.04 x32 $10

Hi, all My blog is http://www.techmozz.com. Actually i am not good with managing servers and i need help in configuring w3 total cache, fastCGI cache and Lowest TTFB on my VPS.

Method i followed

I have followed given below methods in order to configure VPS

  1. https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04
  2. https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04

Configuration i have

Ubuntu 14.04 x32 $10 Nginx wordpress

Issues i am facing

  1. when i am installing w3 total cache plugin on my wordpress, the website starts showing 502 bad gateway. dont know how to resolve this.

What help i need

  1. Complete step by step guide to configure w3 total cache for best performance along with minify, and static content caching. i don’t have CDN

  2. Nginx optimization as per my VPS configuration given above

  3. FastCGI caching configuration

  4. Configuration for best TTFB

Thanks in advance.


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.

@sourabhv1989

If you’re using NGINX FastCGI Caching, there’s very little that W3TC or WP Super Cache will be able to offer you, even if you store FastCGI Cache to disk instead of RAM. Minification is about the only thing FastCGI cache doesn’t handle, but Pagespeed** does.

Essentially, these plugins store static pages as a means of caching your site – FastCGI Cache does the same thing. The difference between the two is NGINX is managing the FastCGI Cache whereas with a plugin, your PHP code is handling it. NGINX is going to handle it much faster, though there’s a downside.

The downside is that, unlike W3TC and WPSC, FastCGI Cache does not auto-purge when you add a new page, post a new post, update pages/posts, etc. You have to clear it manually.

There is a FastCGI Cache helper plugin, but it relies on a module that requires that you compile NGINX from source and build that module in. Said module also doesn’t work with the latest version of NGINX, so you’d have to rely on a slightly dated version of NGINX until the module is updated (which doesn’t appear as if it’ll be anytime soon).

As far as W3TC goes, there’s really not a one-shot configuration that “just works.”

When you step in to minification, you step in to an area that is going to require that you’re capable of troubleshooting, especially when using auto-minify.

Auto-Minify just doesn’t work well when there’s a ton of JS files as not all JS files follow the same spec in terms of coding, thus not all will minify as expected. You may have 20-30 JS files and 10-15 of those will work as expected and you’ll have to troubleshoot why you can’t minify the last 5-15. Doing so may result in odd looking pages, missing content, etc.

** Pagespeed, like the FastCGI Cache Purge module, requires that you build NGINX from source. It’s not part of the NGINX Core.

All that being said, I can help you with one aspect of getting NGINX setup. I wrote an auto-installer which installs the latest Mainline version of NGINX and comes stock with a pre-optimized configuration.

It builds NGINX from source and includes pagespeed so you can tinker with it.

There’s auto-installers for NGINX, PHP 5.6/7.0/7.1, and MariaDB. I’d recommend running this on a clean Droplet (i.e. freshly deployed, nothing installed by you).

cd /opt \
&& git clone https://github.com/serveradminsh/installers.git
&& cd installers/nginx \
&& chmod +x installer.sh \
&& ./installer.sh

That’ll auto install NGINX. You can then change over to the other directories to auto-install MariaDB and PHP using the same commands.

i.e.

cd installers/mariadb/10.x \
&& chmod +x installer.sh \
&& ./installer.sh
cd installers/php/7.1 \
&& chmod +x installer.sh
&& ./installer.sh

You’ll still need to configure server blocks, your sites, setup them up, etc, though these offer a way to get the server setup. Security isn’t a factor here, so you’ll need to properly secure your server, etc. I am working on a full LEMP Stack installer, though it’ll be a little bit before it’s ready for production use.

Hi @sourabhv1989

You might want to add HTTPS, so you can deliver content over HTTP/2, which delivers through one tunnel instead of creating a connection for each object (image, css, js, etc) on the server.

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04

@sourabhv1989 im not an expert, but as far i think, you should skip w3tc when you are using FastCGI. the reason for this is, w3tc store cached files in disk which is the slowest part of your setup. on the other hand, you can setup FastCGI to store cache files in memory (var/run/) which is alone pretty fast. having properly configured FastCGI is enough alone to make your site blazing fast. W3tc could even degrade performance in this case.

as for optimizing Nginx, follow this guide https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration

and this one for setting up FastCGI https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps