<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Smartsourcing Global Blog &#187; WordPressU</title>
	<atom:link href="http://smartsourcingglobal.com/wordpress/tag/wordpressu/feed/" rel="self" type="application/rss+xml" />
	<link>http://smartsourcingglobal.com/wordpress</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 20 Aug 2010 19:07:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Migrating WordPressMU set up from Apache to Ngnix server</title>
		<link>http://smartsourcingglobal.com/wordpress/2009/12/migrating-wordpressmu-set-up-from-apache-to-ngnix-server/</link>
		<comments>http://smartsourcingglobal.com/wordpress/2009/12/migrating-wordpressmu-set-up-from-apache-to-ngnix-server/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 22:37:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ngnix]]></category>
		<category><![CDATA[Server performance]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPressU]]></category>

		<guid isPermaLink="false">http://smartsourcingglobal.com/wordpress/?p=81</guid>
		<description><![CDATA[This post covers 2 topics &#8211; Ngnix performance compared to Apache server and steps for migrating WordPressMU from Apache to Ngnix.
We developed a social community product on Ruby on Rails platform. We used WordpressMU to manage many article pages on the website. Initially, we used Apache HTTP webserver. During the effort of optimizing performance of [...]]]></description>
			<content:encoded><![CDATA[<p>This post covers 2 topics &#8211; Ngnix performance compared to Apache server and steps for migrating WordPressMU from Apache to Ngnix.</p>
<p>We developed a social community product on Ruby on Rails platform. We used WordpressMU to manage many article pages on the website. Initially, we used Apache HTTP webserver. During the effort of optimizing performance of the product, we realized that <strong>Ngnix  </strong>(http://nginx.net/) server performed better in comparison with Apache.<br />
Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Nginx doesn&#8217;t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but most importantly, predictable amounts of memory under load.</p>
<p>Nginx powers several high-visibility sites, such as WordPress, Hulu, Github, Ohloh, SourceForge and TorrentReactor. The main advantage of the asynchronous approach on Ngnix is scalability. In a process-based server like Apache, each simultaneous connection requires a thread which incurs significant overhead. Nginx is faster at serving static files. So for all the good reasons, we decided to migrate our site to Nginx.</p>
<p>There were quite a few things needed to integrate WordpressMu with Nginx server. Here are the steps<br />
1.	Install Nginx:  [root@localhost]#  yum install nginx<br />
2.	create the system sartup links for Nginx:<br />
[root@localhost]# /sbin/chkconfig &#8211;level 35 nginx on<br />
3.	shut down the apache web service:<br />
[root@localhost]# /sbin/service httpd stop<br />
4.	start the Nginx web service:<br />
[root@localhost]# /sbin/service nginx start<br />
5.	Make PHP5 work in Nginx through FastCGI.<br />
Install all these packages:<br />
[root@localhost]#  yum install lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy<br />
6.	Open /etc/php.ini and add the line cgi.fix_pathinfo = 1 right at the end of the file:<br />
7.	Start a PHP FastCGI daemon listening on port 9000, run it as the user ngnix and group nginx<br />
root@localhost]#  /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid<br />
8.	Restart PHP FastCGI daemon<br />
root@localhost]# ps -ef|grep php-cgi<br />
root@localhost]# kill PROCESS_ID<br />
9.	To have the system execute the command automatically at boot time, open /etc/rc.local&#8230;<br />
root@localhost]#  vi /etc/rc.local<br />
and Add the command at the end of the file:<br />
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx  -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid<br />
10.	Stop the Apache server<br />
root@localhost]# /sbin/init.d/httpd stop<br />
To disable apache on startup:<br />
root@localhost]#  /sbin/chkconfig &#8211;level 35 httpd off</p>
<p>It is advisable to keep a backup of your Nginx configuration file:<br />
root@localhost]#  cp /etc/nginx/nginx.conf nginx.conf_cp<br />
Add following code to the Ngnix.conf<br />
  server {<br />
        listen       80;<br />
        server_name  localhost.localdomain;<br />
        #charset koi8-r;<br />
       location / {<br />
            root   /usr/share/nginx/html;<br />
            index index.php index.html index.htm;<br />
           }<br />
        error_page  404              /404.html;<br />
        location = /404.html {<br />
            root   /usr/share/nginx/html;<br />
        }</p>
<p>        # redirect server error pages to the static page /50x.html<br />
        #<br />
        error_page   500 502 503 504  /50x.html;<br />
        location = /50x.html {<br />
            root   /usr/share/nginx/html;<br />
        }</p>
<p>	location ~ ^/(wordpress)/(.*)$ {<br />
    root           /usr/share/nginx/html;<br />
    index index.php;<br />
		fastcgi_pass   127.0.0.1:9000;<br />
		fastcgi_index  index.php;<br />
		fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;<br />
		include        fastcgi_params;<br />
        }<br />
	location  / {<br />
}</p>
<p>11.	Now, to deal with the pretty URLs, add the following code for fixing the WordpressMU&#8217;s Pretty URLs.  In location parenthesis above you can paste following code:<br />
 rewrite  ^.*/.*/files/(.*) /wordpress/wp-content/blogs.php?file=$1;<br />
    if (!-e $request_filename) {<br />
    rewrite  ^.+?(/wp-.*)     /wordpress$1          last;<br />
    rewrite  ^.+?(/.*\.php)$  /wordpress$1          last;<br />
    rewrite ^(.+)$ /wordpress/index.php?q=$1        last;<br />
    break;<br />
    }<br />
12.	For fixing the images issue with Nginx server use following code, paste it  before location parenthesis,<br />
#images for WordPress site<br />
        location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$<br />
            {<br />
          root /usr/share/nginx/html/wordpress;<br />
          rewrite ^/.*(/wp-admin/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;<br />
          rewrite ^/.*(/wp-includes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;<br />
          rewrite ^/.*(/wp-content/themes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;<br />
          rewrite ^/.*(/wp-content/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;<br />
          rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wordpress/wp-content/blogs.php?file=$1 last;<br />
          expires 10d;<br />
          break;<br />
            }<br />
Following articles we found helpful with making the changes.<br />
URL : http://www.wikivs.com/wiki/Lighttpd_vs_nginx<br />
URL : http://www.wikivs.com/wiki/Apache_vs_nginx</p>
<p>Contributors &#8211; Rohit Jain, Amol Nirmala Waman</p>
]]></content:encoded>
			<wfw:commentRss>http://smartsourcingglobal.com/wordpress/2009/12/migrating-wordpressmu-set-up-from-apache-to-ngnix-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
