<?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>Ryan Troy &#187; hosting</title>
	<atom:link href="http://moxiefoxtrot.com/tag/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://moxiefoxtrot.com</link>
	<description>...a random blog about life and technology</description>
	<lastBuildDate>Sun, 18 Dec 2011 02:45:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Install nginx w/ php5 on Ubuntu 8.10</title>
		<link>http://moxiefoxtrot.com/2008/12/01/install-nginx-and-php5-on-ubuntu-810/</link>
		<comments>http://moxiefoxtrot.com/2008/12/01/install-nginx-and-php5-on-ubuntu-810/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 20:47:10 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Articles & Reviews]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://moxiefoxtrot.com/?p=211</guid>
		<description><![CDATA[Below are the steps I took to configure nginx and php5 on my Ubuntu 8.10 server. I choose nginx because its lightweight and relatively easy to manage once you figure out the configuration. I&#8217;ve been using Apache for years and its second nature at this point, however, on my small VPS server I needed to [...]]]></description>
			<content:encoded><![CDATA[<p>Below are the steps I took to configure nginx and php5 on my Ubuntu 8.10 server. I choose nginx because its lightweight and relatively easy to manage once you figure out the configuration. I&#8217;ve been using Apache for years and its second nature at this point, however, on my small VPS server I needed to maximize my resources.</p>
<p>Make sure your system is updated:</p>
<p><code>sudo aptitude update &amp;&amp; sudo aptitude safe-upgrade</code></p>
<p>Install nginx and PHP5, we&#8217;ll be installing the cgi version of php.</p>
<p><code>sudo aptitude install nginx php5-cgi</code></p>
<p>Download the following php-fastcgi startup script and save it to /etc/init.d/php-fastcgi. Nginx will use php in cgi-mode which is why we are creating a init file for it. (note: I found this init script on a mailing list someplace)</p>
<p>Download: <a rel="attachment wp-att-213" href="http://moxiefoxtrot.com/2008/12/01/install-nginx-and-php5-on-ubuntu-810/php-fastcgi/">php-fastcgi init script</a></p>
<p>Next, run the following commands on the php-fastcgi script.</p>
<p><code>sudo chmod u+x /etc/init.d/php-fastcgi<br />
sudo chown 0.0 /etc/init.d/php-fastcgi<br />
sudo update-rc.d php-fastcgi defaults 21 23</code></p>
<p>Now, go ahead and create your directory that will store your website. For example you might do the following:</p>
<p><code>mkdir -p /home/username/domains/yourdomaincom/{public_html,log,cgi-bin}</code></p>
<p>Modify the /etc/nginx/nginx.conf file and set the following variable. I have mine set to 15MB but if you wish to allow larger files to be uploaded over http set this accordingly.</p>
<p><code>client_max_body_size 15m;</code></p>
<p>Finally, lets setup a virtual domain. Navigate to the /etc/nginx/sites-available directory and create a file called yourdomain.com (replace with your domain) and use the following as a template. Make sure to replace your paths etc.</p>
<p>[sourcecode language='css']server {<br />
listen  80;<br />
server_name  yourdomain.com www.yourdomain.com;</p>
<p>access_log  /home/username/domains/yourdomain.com/log/access.log;</p>
<p>location / {<br />
root   /home/username/domains/yourdomain.com/public_html;<br />
index  index.html index.htm index.php;<br />
}</p>
<p># pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000<br />
#<br />
location ~ \.php$ {<br />
fastcgi_pass   127.0.0.1:9000;<br />
fastcgi_index  index.php;<br />
fastcgi_param  SCRIPT_FILENAME  /home/username/domains/yourdomain.com/public_html$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
}[/sourcecode]</p>
<p>Like apache, nginx has a sites-available and sites-enabled folder this allows for better control of active/disabled virtual domains. Navigate to the /etc/nginx/sites-enabled folder and create a symlink back to your virtual host&#8217;s configuration.</p>
<p><code>cd /etc/nginx/sites-enabled/ &amp;&amp; sudo ln -s ../sites-available/yourdomain.com</code></p>
<p>Finally, lets start everything up.<br />
<code>/etc/init.d/php-fastcgi start<br />
/etc/init.d/nginx start</code></p>
<p>At this point you should be able to browse to your site using your domain name. You can easily duplicate multiple domains by creating new virtual host files and creating the sym link as noted above, remember that ngix will need to be restarted.</p>
]]></content:encoded>
			<wfw:commentRss>http://moxiefoxtrot.com/2008/12/01/install-nginx-and-php5-on-ubuntu-810/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

