nginx configuration for wordpress

4
(1)

Simple nginx configuration to launch wordpress site

server {
        server_name yourdomain.com;
        root /var/www/wp; # path to wordpress
        index index.php;

        gzip on; # enable gzip compression
        gzip_disable "msie6";
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

        location ~ /. {
                deny all; # disable hidden files
        }

        location ~* /(?:uploads|files)/.*.php$ {
                deny all; # disable uploaded scripts
        }

        location ~* ^.+.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                access_log off;
                log_not_found off;
                expires max; # static caching
        }

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

        location ~ .php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

Similar Posts:

975

How useful was this post?

Click on a star to rate it!

Average rating 4 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

1 thought on “nginx configuration for wordpress”

  1. Hey would you mind letting me know which web host you’re
    working with? I’ve loaded your blog in 3 different
    browsers and I must say this blog loads a lot faster then most.
    Can you suggest a good internet hosting provider at a fair price?

    Thanks a lot, I appreciate it!

Leave a Comment

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

Scroll to Top