<?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>Mostly Nothing &#187; apache</title>
	<atom:link href="http://mostlynothing.info/news/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://mostlynothing.info</link>
	<description>Talking about what everyone else is talking about</description>
	<lastBuildDate>Sat, 09 Jan 2010 04:31:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting up nginx and WordPress on ArchLinux</title>
		<link>http://mostlynothing.info/news/2010/setting-up-nginx-and-wordpress/</link>
		<comments>http://mostlynothing.info/news/2010/setting-up-nginx-and-wordpress/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 22:22:08 +0000</pubDate>
		<dc:creator>Ttech</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-cgi]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mostlynothing.info/?p=7</guid>
		<description><![CDATA[We have come a long way from the early days of the internet, there are many choices regarding to services and servers. It can be a bit tricky trying to setup your own server, especially if you’re new to it &#8211; either coming from a shared host or deciding to simply take the plunge. There [...]]]></description>
			<content:encoded><![CDATA[<p>We have come a long way from the early days of the internet, there are many choices regarding to services and servers. It can be a bit tricky trying to setup your own server, especially if you’re new to it &#8211; either coming from a shared host or deciding to simply take the plunge. There are many choices for web servers. Although by far one of the most popular and easiest to configure on a server is Apache, it is not necessarily the best for all needs. Luckily there are other server demons that are around such as  IIS (Even though it is a Windows only product, it is quite popular), Ligttpd, and ningx. The latter two are both light resources; however, I decided to switch to nginx.</p>
<h2>What is nginx?</h2>
<p>nginx is a open source lightweight high-performance web server and reverse proxy (for both email and http) that runs on most common operating systems including Linux and Windows (http://www.kevinworthington.com/nginx-for-windows/). Of course not everything works straight out of the box for example PHP support is not built in but is easy to add to the system. Before you begin you should know that the configuration in nginx is different than in Apache. If you’re wondering why to bother switching any other web server since there are compatibility issues; the reason is simple &#8211; memory usage. Switching to nginx (at least for me) cut back my http server resources from 30-50% to just 2-4%. Granted sites such as wordpress.com and sourceforge.net use it.</p>
<h2>Getting Started</h2>
<p>For the past few months I’ve been tinkering with nginx on different Linux systems (Ubuntu and Arch Linux) and while the package manager builds have most things needed for a web server, they do lack some features that could be helpful. I decided to compile my own version with the features I needed, however if your not comfortable with this then in the configuration just skip down to the part for setting up nginx.<br />First there are some prerequisites that we&#8217;ll need to compile spawnfcgi and nginx. There are other packages you might need depending on what you add in the configuration, I may have inadvertently forgotten some in which case let me know.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo pacman -S php-cgi php52 base-devel wget curl</div></div>
<h3>Setting up nginX</h3>
<p>Here&#8217;s the configuration script I used for nginx on Arch</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure &nbsp;<span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx \<br />
<span style="color: #660033;">--sbin-path</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx \<br />
<span style="color: #660033;">--pid-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid \<br />
<span style="color: #660033;">--lock-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>nginx.lock \<br />
<span style="color: #660033;">--http-client-body-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>client_body_temp \<br />
<span style="color: #660033;">--http-proxy-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>proxy_temp<br />
<span style="color: #660033;">--http-fastcgi-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>fastcgi_temp<br />
<span style="color: #660033;">--http-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>access.log<br />
<span style="color: #660033;">--error-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>error.log<br />
<span style="color: #660033;">--user</span>=http \<br />
<span style="color: #660033;">--with-ipv6</span> \<br />
<span style="color: #660033;">--group</span>=http \<br />
--with-http_ssl_module \<br />
--with-http_flv_module \<br />
--with-http_gzip_static_module \<br />
--without-mail_pop3_module \<br />
--without-mail_imap_module \<br />
--without-mail_smtp_module</div></div>
<p>
Basically I disabled all the mail proxy modules and added a few other modules that were not loaded in the pacman version, (such as http_flv). This lets us add custom modules if we wanted to with this flag &#8211;add-module=/path/to/module. Once down adding what you want then just configure and get compiling. Depending on your system you may need to change the paths I setup, but they should be the exact same as the pacman package.  That said, if you want to install the pacman package you should be able to and then follow along below. Next we need to compile.
</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ make<br />
$ sudo make install</div></div>
<h3>Setting up spawn-fcgi</h3>
<p>Until recently the spawn-fcgi source was only available as part of lighttpd however it is now its own package so we simply need to fetch it and get started. There is nothing really tricky about spawn a href=&#8221;http://redmine.lighttpd.net/projects/spawn-fcgi/news&#8221;>fcgi</a>, I just used the defaults /usr/local/ as the path, if you need to change it feel free to. The current version at the time of writing was 1.6.3, so the tutorial will be using that.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz; tar -xzvf spawn-fcgi-1.6.3.tar.gz; cd ./spawn-fcgi-1.6.3<br />
$ ./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install</div></div>
<p>We also need to make a rc script so we can get php-cgi to start and stop easily, below is one I made up:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #666666; font-style: italic;"># general config</span><br />
<br />
<span style="color: #007800;">NGINX_CONFIG</span>=<span style="color: #ff0000;">&quot;/etc/nginx/conf/nginx.conf&quot;</span><br />
<br />
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.conf<br />
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>functions<br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> check_config <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; stat_busy <span style="color: #ff0000;">&quot;Checking configuration&quot;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">-t</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$NGINX_CONFIG</span>&quot;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; stat_die<br />
&nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; stat_done<br />
&nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
&nbsp; start<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; check_config<br />
&nbsp; &nbsp; stat_busy <span style="color: #ff0000;">&quot;Starting Nginx&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; stat_fail<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># probably ;)</span><br />
&nbsp; &nbsp; &nbsp; stat_busy <span style="color: #ff0000;">&quot;Nginx is already running&quot;</span><br />
&nbsp; &nbsp; &nbsp; stat_die<br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$NGINX_CONFIG</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; stat_fail<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; add_daemon nginx<br />
&nbsp; &nbsp; &nbsp; stat_done<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; stop<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; stat_busy <span style="color: #ff0000;">&quot;Stopping Nginx&quot;</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-QUIT</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; stat_fail<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; rm_daemon nginx<br />
&nbsp; &nbsp; &nbsp; stat_done<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; restart<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #007800;">$0</span> stop<br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; <span style="color: #007800;">$0</span> start<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; reload<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; check_config<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; status <span style="color: #ff0000;">&quot;Reloading Nginx Configuration&quot;</span> <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-HUP</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid<span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; check<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; check_config<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;usage: $0 {start|stop|restart|reload|check}&quot;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span><br />
<span style="color: #c20cb9; font-weight: bold;">cat</span>: restart: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory</div></div>
<h2>Getting nginx setup</h2>
<p>Now that everything is compiled and installed, nginx needs to be configured for any virtual-hosts that you may have. Also we need to setup wordpress which requires a few other configuration options other then the normal ones. As I said before configuration in nginx is different then in Apache, there is no httpd-vhost.conf, we will have to make one. Go to your /etc/nginx/conf directory, and make a new directory called sites, in here we will store all the virtual hosts that will be loaded. Once this directory is created go to it and create a new file called default.conf in your favorite editor. Now we will begin configuration of nginx for the first site and for WordPress.</p>
<p><em>nginx.conf</em></p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">user http http;<br />
worker_processes &nbsp;2; # Adjust to your needs<br />
<br />
error_log &nbsp;logs/error.log;<br />
<br />
events {<br />
&nbsp; &nbsp;worker_connections &nbsp;1024;<br />
}<br />
<br />
http {<br />
&nbsp; &nbsp;include &nbsp; &nbsp; &nbsp; mime.types;<br />
&nbsp; &nbsp;default_type &nbsp;application/octet-stream;<br />
<br />
&nbsp; &nbsp;log_format &nbsp;main &nbsp;'$remote_addr - $remote_user [$time_local] &quot;$request&quot; '<br />
&nbsp; &nbsp; &nbsp; &nbsp;'$status $body_bytes_sent &quot;$http_referer&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;'&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';<br />
<br />
&nbsp; &nbsp;access_log &nbsp;logs/access.log &nbsp;main;<br />
<br />
&nbsp; &nbsp; sendfile &nbsp; &nbsp; &nbsp; &nbsp;on;<br />
&nbsp; &nbsp; tcp_nopush &nbsp; &nbsp; on;<br />
&nbsp; &nbsp; server_names_hash_bucket_size 128; # this seems to be required for some vhosts<br />
<br />
&nbsp; &nbsp; keepalive_timeout &nbsp;65;<br />
<br />
&nbsp; &nbsp; gzip on;<br />
&nbsp; &nbsp; gzip_min_length &nbsp;1100;<br />
&nbsp; &nbsp; gzip_buffers &nbsp; &nbsp; 4 8k;<br />
&nbsp; &nbsp; gzip_types &nbsp; &nbsp; &nbsp; text/plain;<br />
<br />
&nbsp; &nbsp; &nbsp;include sites/*.conf;<br />
}</div></div>
<p><em>default.conf</em></p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server {<br />
&nbsp; &nbsp; &nbsp; &nbsp; listen &nbsp; &nbsp; &nbsp; 80;<br />
&nbsp; &nbsp; &nbsp; &nbsp; server_name &nbsp;mostlynothing.info www.mostlynothing.info;<br />
&nbsp; &nbsp; &nbsp; &nbsp; charset koi8-r;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; access_log /etc/nginx/logs/access.log &nbsp;main;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp;/etc/nginx/http;<br />
&nbsp; &nbsp; &nbsp; &nbsp; index = index.php;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; location / {<br />
&nbsp; &nbsp; # This is the equivalent of modrewrite here<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try_files $uri $uri/ /index.php?q=$uri&amp;$args;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;# Configurre All Error Pages <br />
&nbsp; &nbsp; &nbsp; &nbsp; error_page &nbsp;404 &nbsp; &nbsp; &nbsp; /404.html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; error_page &nbsp;403 &nbsp; &nbsp; &nbsp; /403.html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; error_page &nbsp; 500 502 503 504 &nbsp;/50x.html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; location = /50x.html {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Give all php data to the Fast CGI handler that should be running.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; location ~ \.php$ {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_pass &nbsp; 127.0.0.1:9000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_index &nbsp;index.php;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_param &nbsp;SCRIPT_FILENAME &nbsp;/etc/nginx/http$fastcgi_script_name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; fastcgi_params;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # deny access to .htaccess files, if Apache's document root<br />
&nbsp; &nbsp; &nbsp; &nbsp; # concurs with nginx's one<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; location ~ /\.ht {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; deny &nbsp;all;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</div></div>
<ul>
<li>The listen and server_name lines set what port to listen on and what domains are setup for this vhost.</li>
<li>The root line sets the document root directory and index sets what page should be looked for to load. This is very important.</li>
<li>The error pages are static, and on a WordPress site not often called but its better to be safe.</li>
<li>If you notice on the server block, there are several locations, the first sets the default location and rewrite rules, the second configures the fast cgi handler, the third stops people from accessing any leftover .htaccess files you may have had.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mostlynothing.info/news/2010/setting-up-nginx-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

