Archive for juin, 2011

WordPress 3 nginx virtualhost configuration

juin 22nd, 2011

Hi there,

another configuration file for WordPress 3 running on Nginx:


server
        {
                listen 80;
                server_name blog.******.com;
                root /var/www/blog;
                index index.php;

                location /
                {
                        try_files $uri $uri/ @wordpress;
                }

                # BLOCKS ACCESS TO . FILES (.svn, .htaccess, ...)
                location ~ /\. {
                        deny  all;
                }

                # FOR PHP FILES
                location ~* \.php$ {
                        try_files $uri $uri/ @wordpress;

                        fastcgi_pass 127.0.0.1:9000;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include fastcgi_params;
                }

                location @wordpress {
                        fastcgi_pass 127.0.0.1:9000;
                        #fastcgi_index index.php;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME  $document_root/index.php;
                        break;
                }

                location ~ /\. {
                        deny  all;
                }

                location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff$ {
                        expires 30d;
                }
}

There you go!

Tags: , , ,
Posted in System, Technology | Comments (0)