Boost WordPress with nginx front end

Prepare for real performance boost. Run Nginx in a front of Apache and serve all static content directly from Nginx. All php script requests are transparently forwarded to Apache daemon and output forwarded back to Nginx that servers it to a web visitor.

Web visitor -> Nginx -> static content -> Nginx -> Web visitor

if dynamic content then,

Web visitor -> Nginx -> dynamic content -> Apache -> Nginx -> Web visitor

For static content serving you should add the following nginx config:

location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|rtf|js)$ {
root /usr/www;
expires 10d;
break;
}

With the following config you will serve all those files directly via Nginx and it will be very fast. Don’t forget to set-up Nginx listening to public IP and Apache configure to a different port or internal IP.


Leave a Reply