nginx wordpress configuration

By | December 29, 2014

Advertisement from Google

Simple but working nginx configuration for wordpress based web site…

server {
        server_name site.com;
        root /var/site.com/www;
        index index.php;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        location ~ /\. {
                deny all;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
        }

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

Advertisement from Google

This is the basic configuration for WordPress. If you are going to use WP Super Cache or W3 Total Cache look at this article

You can find basic nginx configuration here

Leave a Reply

Your email address will not be published. Required fields are marked *