Help optimizing the server for Wordpress (Ubuntu + Nginx + Varnish)

  • Posted on July 18, 2013
  • testoniAsked by testoni

Hi, I’m trying to optimize my server and would be great if someone could help me with the best configuration. The server will be used only to host Wordpress sites (multiple domains), currently I’m using a 2 core/ 2Gb droplet with Ubuntu 12.04 x64 + Nginx + Varnish.

Here are my configs so far:


user www-data; worker_processes 4; pid /var/run/;

events { worker_connections 768; }

http {

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    port_in_redirect off;
    server_names_hash_bucket_size 64;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";






-T localhost:6082
-f /etc/varnish/default.vcl
-S /etc/varnish/secret
-s malloc,1500m”

    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .between_bytes_timeout = 600s;
    .max_connections = 800;
    set req.grace = 2m;
    set beresp.grace = 2m;

Is this ok? Am I missing something? Can I improve it?

I read some people saying that I could use ‘file’ instead of ‘malloc’ on varnish to take advantage of the SSD disks, would it be better?

Thank you, any thoughts would be really appreciate.

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.

@Pablo: Thank you! The links were really helpful. :)

Just in case you run across this, I’ve seen nginx throw 500 errors when updating WordPress posts/pages that contain a lot of data. <br> <br>Setting client_body_temp_path fixed the problem for me.