Nginx is becoming very popular to host the websites. WordPress is best and popular CMS in the world now. Nginx gives really great performance with wordpress sites. Earlier I given the Nginx configuration with this code. I given code for wordpress and Nginx configuration. For hosting your wordpress website on Nginx server is the best option.

nginx wordpress plugins nginx setup for wordpress

If you have dedicated server then go with nginx server.

wordpress + Nginx + permalink

nginx wordpress plugins nginx setup for wordpress

nginx wordpress plugins nginx setup for wordpress

I found two plugins which are supported to Nginx installtion. But both plugins are not give you nginx rule for setup nginx rule.

http://wordpress.org/extend/plugins/nginx-compatibility/
http://wordpress.org/extend/plugins/nginx-proxy-cache-integrator/

Now I will show you how setup wordpress site on Nginx server.

Just put following code in your nginx.conf file. This code will fix the wordpress permalink issue also.

server {
listen 80;
server_name localhost.localdomain;
# access_log logs/site.access.log;

location / {
root /usr/share/nginx/html;
index index.php;

if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) /$1 last;
rewrite ^.+?(/.*.php)$ /$1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
break;
}

location = /50x.html {
fastcgi_passĀ  localhost:9999;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SCRIPT_FILENAMEĀ  /var/www/example.com$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
root /var/www/nginx-default;
}

}

Note: Dont forgot to install fastcgi on your server. Start the fastcgi server on port no 9000(which is default port)

For wordpressMu use following URL

http://wordpressapi.com/nginx-rule-for-wordpressmu-with-pretty-url/

Written by Purab Kharat

I Purab am from India, Pune. I am WordPress and Drupal Architect and consultant. I worked on many technologies like Ruby on Rails, Flex, PHP, jQuery etc... Senior Technical Lead at Smartsourcing Global Pvt Ltd in Princeton, NJ, USA.I contributed to many wordpress plugins and Drupal Modules. I contributed to Drupal core also.Connect to purab on LinkedIn or Follow @purab on Twitter or Follow me on Google+ or Write Mail to purabdk@gmail.com or Chat with me on Skype : purabdk

Leave a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>