<?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>Admins Goodies &#187; nginx</title>
	<atom:link href="http://adminsgoodies.com/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>http://adminsgoodies.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Tue, 21 May 2013 16:33:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How do you restart php-fpm?</title>
		<link>http://adminsgoodies.com/how-do-you-restart-php-fpm/</link>
		<comments>http://adminsgoodies.com/how-do-you-restart-php-fpm/#comments</comments>
		<pubDate>Sat, 11 May 2013 16:33:53 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/how-do-you-restart-php-fpm/</guid>
		<description><![CDATA[I need to reload my php.ini and there&#8217;s nothing in the help dialog about restarting it. Asked by Galen Assuming you have the appropriate RC scripts in place, /etc/init.d/php-fpm restart or restart php-fpm or service php-fpm restart or service php5-fpm restart Or whatever the equivalent is on your system. Edited to include suggestion from Matt Winckler. Answered by tylerl Check more discussion of this question.]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I need to reload my php.ini and there&#8217;s nothing in the help dialog about restarting it.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/8257/galen" target="_blank">Galen</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Assuming you have the appropriate RC scripts in place, </p>
<pre class="prettyprint"><code>/etc/init.d/php-fpm restart
</code></pre>
<p>or </p>
<pre class="prettyprint"><code>restart php-fpm
</code></pre>
<p>or </p>
<pre class="prettyprint"><code>service php-fpm restart
</code></pre>
<p>or</p>
<pre class="prettyprint"><code>service php5-fpm restart
</code></pre>
<p>Or whatever the equivalent is on your system.</p>
<p><em><strong>Edited to include suggestion from  Matt Winckler.</em></strong></p>
<div class="author">Answered by <a href="http://serverfault.com/users/6800/tylerl" target="_blank">tylerl</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/189940/how-do-you-restart-php-fpm" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/how-do-you-restart-php-fpm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx rewrite rule “^/([a-z0-9]{32})\.png$” not working (used to work on Apache)</title>
		<link>http://adminsgoodies.com/nginx-rewrite-rule-a-z0-932-png-not-working-used-to-work-on-apache/</link>
		<comments>http://adminsgoodies.com/nginx-rewrite-rule-a-z0-932-png-not-working-used-to-work-on-apache/#comments</comments>
		<pubDate>Thu, 24 Jan 2013 17:33:51 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[vhosts]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/nginx-rewrite-rule-a-z0-932-png-not-working-used-to-work-on-apache/</guid>
		<description><![CDATA[I have these rewrite rules (I tried both with no avail): location ~* "^/([a-z0-9]{32})\.png$" { rewrite ^ /index.php?page=log&#38;id=$1 last; } and location ~* "/(?&#60;hash&#62;[a-z0-9]{32})\.png" { rewrite ^ /index.php?page=log&#38;id=$hash; } and location / { try_files $uri $uri/ @rewrites; }location @rewrites { rewrite "^/([a-zA-Z0-9]{32})\.png$" /index.php?page=log&#38;id=$1 last; #... } Basically, I want the URL http://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.png to actually pass the parameters to my index.php script, and in the script, I got: $db-&#62;save_hash($_GET['id']); header('Content-type: image/png'); readfile('images/beacon.png'); break; But nginx is [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I have these rewrite rules (I tried both with no avail):</p>
<pre class="prettyprint"><code>location ~* "^/([a-z0-9]{32})\.png$" {
  rewrite ^ /index.php?page=log&amp;id=$1 last;
} 
</code></pre>
<p>and</p>
<pre class="prettyprint"><code>location ~* "/(?&lt;hash&gt;[a-z0-9]{32})\.png" {
  rewrite ^ /index.php?page=log&amp;id=$hash;
}
</code></pre>
<p>and</p>
<pre class="prettyprint"><code>location / {
  try_files $uri $uri/ @rewrites;
}location @rewrites {
  rewrite "^/([a-zA-Z0-9]{32})\.png$" /index.php?page=log&amp;id=$1 last;
  #...
}
</code></pre>
<p>Basically, I want the URL <code>http://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.png</code> to actually pass the parameters to my <code>index.php</code> script, and in the script, I got:</p>
<pre class="lang-php prettyprint-override"><code>$db-&gt;save_hash($_GET['id']);
header('Content-type: image/png');
readfile('images/beacon.png');
break;
</code></pre>
<p>But nginx is giving me a &#8220;not found&#8221;, but other rewrites work fine. What gives?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/151339/pocesar" target="_blank">pocesar</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>As per nginx documentation of how the <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#location" rel="nofollow"><code>location</code></a> directive works:</p>
<blockquote>
<p>A location can either be defined by a prefix string, or by a regular expression.<br />
  &#8230;<br />
  A search of regular expressions terminates on the first match, and the corresponding configuration is used.</p>
</blockquote>
<p>Based on addition information <a href="http://serverfault.com/a/471867/151339">from your own answer</a> to this very question, it would seem like you intend on having several location directives to apply simultaneously right at the very same time, which is explicitly not allowed as per the unambiguous documentation.</p>
<p>Remember, nginx is faster and cleaner by design.  So, don&#8217;t expect the quirks!</p>
<div class="author">Answered by <a href="http://serverfault.com/users/110020/cnst" target="_blank">cnst</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/469230/nginx-rewrite-rule-a-z0-932-png-not-working-used-to-work-on-apache" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/nginx-rewrite-rule-a-z0-932-png-not-working-used-to-work-on-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serving static directory on subdomain with assets</title>
		<link>http://adminsgoodies.com/serving-static-directory-on-subdomain-with-assets/</link>
		<comments>http://adminsgoodies.com/serving-static-directory-on-subdomain-with-assets/#comments</comments>
		<pubDate>Tue, 22 Jan 2013 17:34:37 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[static]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/serving-static-directory-on-subdomain-with-assets/</guid>
		<description><![CDATA[I have a html presentation which I would like to serve on a subdomain on my server. It just consists of some static html files and some assets (the Github is here). I&#8217;m trying to write an nginx config file which will serve the presentation. What I have so far is the following: server { server_name make-js-like-ruby.grinnick.com; root /home/dtuite/stuff/presentations/make_js_like_ruby/introduction; access_log off; error_log off; } The actual root file is in /introduction/index.html. Nginx seems to serve [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I have a html presentation which I would like to serve on a subdomain on my server. It just consists of some static html files and some assets (<a href="https://github.com/dtuite/make_js_like_ruby" rel="nofollow">the Github is here</a>).</p>
<p>I&#8217;m trying to write an nginx config file which will serve the presentation. What I have so far is the following:</p>
<pre class="prettyprint"><code>server {
  server_name make-js-like-ruby.grinnick.com;  root /home/dtuite/stuff/presentations/make_js_like_ruby/introduction;  access_log off;
  error_log off;
}
</code></pre>
<p>The actual root file is in <code>/introduction/index.html</code>. Nginx seems to serve that file by default which is fine. The problem is that none of the assets seems to be available on the page. <a href="http://make-js-like-ruby.grinnick.com/" rel="nofollow">You can see the problem live here.</a>.</p>
<p>How do I make the assets are available but also make sure that the subdomain roots to the index file correctly?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/69085/duckyfuzz" target="_blank">duckyfuzz</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<h2>Move Root Path</h2>
<p>Your current directory structure (on your hard drive) is like following</p>
<pre class="prettyprint"><code>/home/dtuite/stuff/presentations/make_js_like_ruby/
    code/
    core/
    extensions/
    images/
    introduction/
    themes/
</code></pre>
<p>However, your root path is set to</p>
<pre class="prettyprint"><code>/home/dtuite/stuff/presentations/make_js_like_ruby/introduction
</code></pre>
<p>The web server will not access any file outside that path. Since <code>themes</code>, <code>images</code>, etc., are all outside the above path, their content will not be served.</p>
<h2>Fix</h2>
<p>I suggest moving the root path one level up</p>
<pre class="prettyprint"><code>root /home/dtuite/stuff/presentations/make_js_like_ruby;
</code></pre>
<p>Then move the <code>index.html</code> into <code>/home/dtuite/stuff/presentations/make_js_like_ruby</code>. Of course links within <code>index.html</code> will have to be modified accordingly.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/138643/john-siu" target="_blank">John Siu</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/471258/serving-static-directory-on-subdomain-with-assets" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/serving-static-directory-on-subdomain-with-assets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cannot restart php5-fpm</title>
		<link>http://adminsgoodies.com/cannot-restart-php5-fpm/</link>
		<comments>http://adminsgoodies.com/cannot-restart-php5-fpm/#comments</comments>
		<pubDate>Sun, 20 Jan 2013 17:34:19 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php-fpm]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/cannot-restart-php5-fpm/</guid>
		<description><![CDATA[I&#8217;ve made some changes in the .ini files and wanted to restart php5-fpm. /etc/init.d/php5-fpm restart Jan 20 14:25:48.171577 [ERROR] bind() for address &#8216;/var/lib/php5-fpm/apps.sock&#8217; failed: Address already in use (98) How can I find out what is using this address? I&#8217;ve already stopped nginx but that didn&#8217;t change anything. Asked by 32bitfloat You can use lsof lsof /var/lib/php5-fpm/apps.sock The output is lines containing the information COMMAND, PID, USER, FD, TYPE, DEVICE, SIZE/OFF, NODE, NAME e.g. lsof [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;ve made some changes in the .ini files and wanted to restart php5-fpm.</p>
<blockquote>
<p>/etc/init.d/php5-fpm restart</p>
<p>Jan 20 14:25:48.171577 [ERROR] bind() for address<br />
  &#8216;/var/lib/php5-fpm/apps.sock&#8217; failed: Address already in use (98)</p>
</blockquote>
<p>How can I find out what is using this address? I&#8217;ve already stopped nginx but that didn&#8217;t change anything.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/126468/32bitfloat" target="_blank">32bitfloat</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You can use lsof</p>
<pre class="prettyprint"><code>lsof /var/lib/php5-fpm/apps.sock
</code></pre>
<p>The output is lines containing the information</p>
<p>COMMAND, PID, USER, FD, TYPE, DEVICE, SIZE/OFF, NODE, NAME e.g.</p>
<pre class="prettyprint"><code>lsof /lib64/libnss_files-2.12.so
COMMAND  PID USER  FD   TYPE DEVICE SIZE/OFF   NODE NAME
bash    2240 iain mem    REG  253,0    65928 142129 /lib64/libnss_files-2.12.so
bash    4700 iain mem    REG  253,0    65928 142129 /lib64/libnss_files-2.12.so
</code></pre>
<div class="author">Answered by <a href="http://serverfault.com/users/9517/iain" target="_blank">Iain</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/470816/cannot-restart-php5-fpm" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/cannot-restart-php5-fpm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does nginx cache (copy) my images?</title>
		<link>http://adminsgoodies.com/does-nginx-cache-copy-my-images/</link>
		<comments>http://adminsgoodies.com/does-nginx-cache-copy-my-images/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 17:33:57 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/does-nginx-cache-copy-my-images/</guid>
		<description><![CDATA[I&#8217;m using http public cache all over an images website to allow clients and anyone between the clients and my server (eg: cloudflare, isp, etc) to cache HTML, assets (js/css/icons), and images (the main content of the website). But I don&#8217;t want nginx to cache these images, because it will take too much space. I&#8217;m not sure whether it&#8217;s happening, I don&#8217;t know how to check. So how do I check, and if it&#8217;s happening, [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;m using http public cache all over an images website to allow clients and anyone between the clients and my server (eg: cloudflare, isp, etc) to cache HTML, assets (js/css/icons), and images (the main content of the website). But I don&#8217;t want nginx to cache these images, because it will take too much space. I&#8217;m not sure whether it&#8217;s happening, I don&#8217;t know how to check.</p>
<p>So how do I check, and if it&#8217;s happening, how do I stop it, without also stopping client and proxies cache?</p>
<p>Note: I&#8217;m using nginx as web server with fastcgi, and not as a proxy</p>
<div class="author">Asked by <a href="http://serverfault.com/users/130929/chocodeveloper" target="_blank">ChocoDeveloper</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>If you haven&#8217;t explicitly set up nginx as a caching proxy, then it will not cache your images or other static content, but merely serve it from the filesystem.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/126632/michael-hampton" target="_blank">Michael Hampton</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/470609/does-nginx-cache-copy-my-images" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/does-nginx-cache-copy-my-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HttpGeoipModule $geoip_country_code is blank</title>
		<link>http://adminsgoodies.com/httpgeoipmodule-geoip_country_code-is-blank/</link>
		<comments>http://adminsgoodies.com/httpgeoipmodule-geoip_country_code-is-blank/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 17:34:26 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/httpgeoipmodule-geoip_country_code-is-blank/</guid>
		<description><![CDATA[In nginx.conf: http { geoip_country /etc/nginx/GeoIP.dat; ... } If I do: server{ ... location / { add_header X-Geo $geoip_country_code; add_header X-Geo3 $geoip_country_code3; add_header X-IP $remote_addr; ... } } Only X-IP show up in my headers. $ curl -I www.example.org HTTP/1.1 302 FOUND Content-Type: text/html; charset=utf-8 Date: Thu, 17 Jan 2013 19:29:23 GMT Location: http://www.example.org/login/?next=/ Server: nginx/1.2.2 Vary: Cookie X-IP: 10.139.34.12 Connection: keep-alive If I change the location block to: location / { add_header X-Geo "foo"; [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>In nginx.conf:</p>
<pre class="prettyprint"><code>http { 
    geoip_country /etc/nginx/GeoIP.dat;
    ...
}
</code></pre>
<p>If I do:</p>
<pre class="prettyprint"><code>server{
    ...
    location / {
        add_header X-Geo $geoip_country_code;                   
        add_header X-Geo3 $geoip_country_code3;
        add_header X-IP $remote_addr;
        ...
    }
}
</code></pre>
<p>Only <code>X-IP</code> show up in my headers. </p>
<pre class="prettyprint"><code>$ curl -I www.example.org
HTTP/1.1 302 FOUND
Content-Type: text/html; charset=utf-8
Date: Thu, 17 Jan 2013 19:29:23 GMT
Location: http://www.example.org/login/?next=/
Server: nginx/1.2.2
Vary: Cookie
X-IP: 10.139.34.12
Connection: keep-alive
</code></pre>
<p>If I change the location block to:</p>
<pre class="prettyprint"><code>location / {
    add_header X-Geo "foo";                   
    add_header X-Geo3 "bar";
    add_header X-IP $remote_addr;
    ...
}
</code></pre>
<p>The headers show up, how can I get <code>$geoip_country_code</code>?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/52636/kit-sunde" target="_blank">Kit Sunde</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Ah I just figure out what was happening. It was trying to resolve the GeoIP for the LoadBalancers IP rather than the client which is why it was blank. Once I curled the host directly, it returned the correct result. I had to use the HttpRealipModule  to give the HttpGeoipModule the clients IP. In my conf:</p>
<pre class="prettyprint"><code>real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
</code></pre>
<div class="author">Answered by <a href="http://serverfault.com/users/52636/kit-sunde" target="_blank">Kit Sunde</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/463971/httpgeoipmodule-geoip-country-code-is-blank" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/httpgeoipmodule-geoip_country_code-is-blank/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot execute PHP file from domain name</title>
		<link>http://adminsgoodies.com/cannot-execute-php-file-from-domain-name/</link>
		<comments>http://adminsgoodies.com/cannot-execute-php-file-from-domain-name/#comments</comments>
		<pubDate>Tue, 15 Jan 2013 17:33:47 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[virtualhost]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/cannot-execute-php-file-from-domain-name/</guid>
		<description><![CDATA[Server run on Amazon Linux AMI** (similary to redhat) I follow the installation from Install PHP-FPM, Nginx, &#38; MySQL on EC2 with Amazon Linux AMI It&#8217;s work properly if I call directly from server IP address like 174.129.213.152/index.php and I can access other file from my domain correctly like http://gamebiz.asia/robots.txt The problem is when I call php file http://gamebiz.asia or http://gamebiz.asia/index.php their result in blank page. I try change configuration from fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; to fastcgi_pass [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>Server run on Amazon Linux AMI** (similary to redhat)</p>
<p>I follow the installation from <a href="http://www.codingsteps.com/install-php-fpm-nginx-mysql-on-ec2-with-amazon-linux-ami/" rel="nofollow">Install PHP-FPM, Nginx, &amp; MySQL on EC2 with Amazon Linux AMI</a></p>
<p>It&#8217;s work properly if I call directly from server IP address like <code>174.129.213.152/index.php</code> <br />and I can access other file from my domain correctly like <code>http://gamebiz.asia/robots.txt</code> </p>
<p>The problem is when I call php file <code>http://gamebiz.asia</code> or <code>http://gamebiz.asia/index.php</code> their result in blank page.</p>
<p> I try change configuration from<br />
<br /><code>fastcgi_pass    unix:/var/run/php-fpm/php-fpm.sock;</code> to <code>fastcgi_pass    127.0.0.1:9000;</code> and <code>fastcgi_pass    localhost:9000;</code></p>
<p>the result when I call php file is &#8220;502 Bad Gateway&#8221; and If I remove <code>fastcgi_pass</code> I got &#8220;download&#8221; file instead of execute php file</p>
<p> <br />
<h1><strong>Configuration</strong></h1>
<h2>conf.d/default.conf</h2>
</p>
<pre class="prettyprint"><code>server{
    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml|mp3|ogg|wav|aac)$ {
        access_log        off;
        log_not_found     off;
        expires           max;
    }
    location ~* \.php$ {
        fastcgi_index   index.php;
        fastcgi_pass    unix:/var/run/php-fpm/php-fpm.sock;
        include /etc/nginx/fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
    server_tokens off;
}
</code></pre>
<h2>sites-available/gamebiz.asia.conf</h2>
<pre class="prettyprint"><code>server {
    server_name  www.gamebiz.asia;
    rewrite ^(.*) http://gamebiz.asia$1 permanent;
}server {
    listen 80;
    server_name gamebiz.asia;
    root   /var/www/html/SpotDiff/Release;
    index index.php index.html;    location ~ \.php$ {
        fastcgi_pass    unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
    }
}
</code></pre>
<p>I try config virtual host and sub-domain follow <a href="http://www.rackspace.com/knowledge_center/article/installing-nginx-and-php-fpm-setup-for-nginx" rel="nofollow">Installing NGINX and PHP-FPM &#8211; Setup for NGINX</a></p>
<p>they said I need to setup the different UNIX Sockets for PHP-FPM in <code>/etc/php5/fpm/pool.d/</code> </p>
<p>Unfortunately Amazon Linux AMI don&#8217;t have apt-get and I don&#8217;t have directory <code>/etc/php5/fpm/pool.d/</code> and I search for <code>pool.d</code> but don&#8217;t know how to get this file and directory. </p>
<p>I end up on change <code>fastcgi_pass</code> from <code>unix:/var/run/php5-fpm/DOMAINNAME.socket;</code> to my default <code>unix:/var/run/php-fpm/php-fpm.sock;</code> but still got blank page</p>
<p>Please help me I struggle with this for 3 whole days. I will appreciate any kind of help. Thank you.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/154462/hsgu" target="_blank">hsgu</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Seems you are missing </p>
<pre class="prettyprint"><code> fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
 fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
</code></pre>
<p>from the config of server_name gamebiz.asia; config block.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/96428/andrei-mikhaltsov" target="_blank">Andrei Mikhaltsov</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/469170/cannot-execute-php-file-from-domain-name" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/cannot-execute-php-file-from-domain-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx / mod_passenger on linode instance with oom messages &#8211; where to look next?</title>
		<link>http://adminsgoodies.com/nginx-mod_passenger-on-linode-instance-with-oom-messages-where-to-look-next/</link>
		<comments>http://adminsgoodies.com/nginx-mod_passenger-on-linode-instance-with-oom-messages-where-to-look-next/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 17:33:36 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[oom]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/nginx-mod_passenger-on-linode-instance-with-oom-messages-where-to-look-next/</guid>
		<description><![CDATA[I am running an Ubuntu Server that is starting to have problems. It&#8217;s very lightly used but am confused to why it is now having memory issues. I&#8217;ve included some of the output from syslog and free -m. What is this telling me exactly and what should I do next? Googling has provided some ambigous answers. It is only a 512MB instance and is set with 512MB of swap with a memory limit of 512 [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I am running an Ubuntu Server that is starting to have problems. It&#8217;s very lightly used but am confused to why it is now having memory issues. I&#8217;ve included some of the output from syslog and free -m. What is this telling me exactly and what should I do next? Googling has provided some ambigous answers. It is only a 512MB instance and is set with 512MB of swap with a memory limit of 512 MB.</p>
<p>thx in advance for any help</p>
<pre class="prettyprint"><code>Jan 14 06:25:15 curren rsyslogd: [origin software="rsyslogd" swVersion="5.8.1" x-pid="2311" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
Jan 14 06:25:16 curren CRON[3242]: (CRON) info (No MTA installed, discarding output)
Jan 14 06:40:59 curren kernel: mysqld invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=0
Jan 14 06:40:59 curren kernel: mysqld cpuset=/ mems_allowed=0
Jan 14 06:40:59 curren kernel: Pid: 2414, comm: mysqld Not tainted 3.6.5-x86_64-linode28 #1
Jan 14 06:40:59 curren kernel: Call Trace:
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810c5fd6&gt;] dump_header+0x7d/0x1af
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810a2d96&gt;] ? delayacct_end+0x74/0x7f
Jan 14 06:40:59 curren kernel: [&lt;ffffffff816ef5a2&gt;] ? _raw_spin_unlock_irqrestore+0x19/0x1c
Jan 14 06:40:59 curren kernel: [&lt;ffffffff813ad18e&gt;] ? ___ratelimit+0xe6/0x104
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810c6372&gt;] oom_kill_process+0x66/0x30c
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810c6822&gt;] out_of_memory+0x20a/0x263
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810ca096&gt;] __alloc_pages_slowpath+0x403/0x4bc
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810ca299&gt;] __alloc_pages_nodemask+0x14a/0x1ae
Jan 14 06:40:59 curren kernel: [&lt;ffffffff813ac0b0&gt;] ? radix_tree_lookup+0x1e/0x54
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810f6391&gt;] alloc_pages_current+0xc5/0xe6
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810c3afb&gt;] __page_cache_alloc+0x87/0x94
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810c51d4&gt;] filemap_fault+0x25a/0x341
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810e1b69&gt;] __do_fault+0xa5/0x3a0
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810e2d03&gt;] handle_pte_fault+0xdd/0x1b5
Jan 14 06:40:59 curren kernel: [&lt;ffffffff81004a4c&gt;] ? xen_pmd_val+0x9/0xb
Jan 14 06:40:59 curren kernel: [&lt;ffffffff81004659&gt;] ? __raw_callee_save_xen_pmd_val+0x11/0x1e
Jan 14 06:40:59 curren kernel: [&lt;ffffffff810e2f32&gt;] handle_mm_fault+0x157/0x169
Jan 14 06:40:59 curren kernel: [&lt;ffffffff816f2947&gt;] do_page_fault+0x364/0x389
Jan 14 06:40:59 curren kernel: [&lt;ffffffff81072fd1&gt;] ? T.800+0x15/0x3b
Jan 14 06:40:59 curren kernel: [&lt;ffffffff81074011&gt;] ? ktime_get_ts+0x44/0x93
Jan 14 06:40:59 curren kernel: [&lt;ffffffff81112067&gt;] ? poll_select_copy_remaining+0xd2/0xf6
Jan 14 06:40:59 curren kernel: [&lt;ffffffff811122d1&gt;] ? sys_select+0xa4/0xb9
Jan 14 06:40:59 curren kernel: [&lt;ffffffff816efb65&gt;] page_fault+0x25/0x30
Jan 14 06:40:59 curren kernel: Mem-Info:
Jan 14 06:40:59 curren kernel: Node 0 DMA per-cpu:
Jan 14 06:40:59 curren kernel: CPU    0: hi:    0, btch:   1 usd:   0
</code></pre>
<p>here is result of free -m`</p>
<pre class="prettyprint"><code>root@curren:/var/log# free -m
             total       used       free     shared    buffers     cached
Mem:           486        481          5          0          0          7
-/+ buffers/cache:        473         13
Swap:          511        507          4
root@curren:/var/log#
</code></pre>
<div class="author">Asked by <a href="http://serverfault.com/users/30169/timpone" target="_blank">timpone</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You really have run out of memory (and swap!).</p>
<p>Either tune your services to use less memory, or buy a VPS with more memory.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/126632/michael-hampton" target="_blank">Michael Hampton</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/468923/nginx-mod-passenger-on-linode-instance-with-oom-messages-where-to-look-next" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/nginx-mod_passenger-on-linode-instance-with-oom-messages-where-to-look-next/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>strange lines in nginx log</title>
		<link>http://adminsgoodies.com/strange-lines-in-nginx-log/</link>
		<comments>http://adminsgoodies.com/strange-lines-in-nginx-log/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 17:33:15 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[amazon-elb]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/strange-lines-in-nginx-log/</guid>
		<description><![CDATA[I&#8217;m running nginx 1.2.6 behind amazon elb. Periodically I see the following lines in nginx access.log: 10.28.135.252 - - [14/Jan/2013:14:20:07 +0000] "-" 400 0 "-" "-" "-" 10.28.135.252 - - [14/Jan/2013:14:20:07 +0000] "-" 400 0 "-" "-" "-" 10.28.135.252 - - [14/Jan/2013:14:20:14 +0000] "-" 400 0 "-" "-" "-" 10.28.135.252 - - [14/Jan/2013:14:20:14 +0000] "-" 400 0 "-" "-" "-" 10.28.135.252 - - [14/Jan/2013:14:20:18 +0000] "-" 400 0 "-" "-" "-" 10.28.135.252 - - [14/Jan/2013:14:20:48 [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;m running nginx 1.2.6 behind amazon elb.</p>
<p>Periodically I see the following lines in nginx access.log:</p>
<pre class="prettyprint"><code>10.28.135.252 - - [14/Jan/2013:14:20:07 +0000] "-" 400 0 "-" "-" "-"
10.28.135.252 - - [14/Jan/2013:14:20:07 +0000] "-" 400 0 "-" "-" "-"
10.28.135.252 - - [14/Jan/2013:14:20:14 +0000] "-" 400 0 "-" "-" "-"
10.28.135.252 - - [14/Jan/2013:14:20:14 +0000] "-" 400 0 "-" "-" "-"
10.28.135.252 - - [14/Jan/2013:14:20:18 +0000] "-" 400 0 "-" "-" "-"
10.28.135.252 - - [14/Jan/2013:14:20:48 +0000] "-" 400 0 "-" "-" "-"
</code></pre>
<p>There are no errors in the error log.<br />
What can it be?</p>
<p>Thanks.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/98709/zaar-hai" target="_blank">Zaar Hai</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>This occurs when a client connects to the web server, but then fails to send a request before disconnecting. It also occurs when a client connects, sends a request with <code>Connection: Keep-Alive</code> set, but disconnects before sending another request. In either case, they can be safely ignored.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/126632/michael-hampton" target="_blank">Michael Hampton</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/468885/strange-lines-in-nginx-log" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/strange-lines-in-nginx-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx unix domain socket error</title>
		<link>http://adminsgoodies.com/nginx-unix-domain-socket-error/</link>
		<comments>http://adminsgoodies.com/nginx-unix-domain-socket-error/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 17:33:43 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/nginx-unix-domain-socket-error/</guid>
		<description><![CDATA[I use fedora 17, and when I setup nginx with uwsgi using unix domain socket, when I place the socket in a directory with proper permission it&#8217;s ok, but when I place the socket in the /tmp it will cause nginx error: connect() to unix:/tmp/MySite.sock failed (2: No such file or directory) while connecting to upstream The file does exist and has read/write permission for nginx user. But what cause this error, its really drive [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I use fedora 17, and when I setup nginx with uwsgi using unix domain socket, when I place the socket in a directory with proper permission it&#8217;s ok, but when I place the socket in the <code>/tmp</code> it will cause nginx error:</p>
<pre class="prettyprint"><code>connect() to unix:/tmp/MySite.sock failed (2: No such file or directory) while connecting to upstream
</code></pre>
<p>The file does exist and has read/write permission for nginx user. But what cause this error, its really drive me crazy, can somebody figure it out.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/152377/jeffgoku" target="_blank">jeffgoku</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You can&#8217;t place sockets intended for interprocess communication in <code>/tmp</code>.</p>
<p>For security reasons, recent versions of Fedora use <a href="http://fedoraproject.org/wiki/Features/ServicesPrivateTmp" rel="nofollow">namespaced temporary directories</a>, meaning every service sees a completely different <code>/tmp</code> and can only see its own files in that directory.</p>
<p>To resolve the issue, place the socket in a different directory, such as <code>/run</code> (formerly known as <code>/var/run</code>).</p>
<div class="author">Answered by <a href="http://serverfault.com/users/126632/michael-hampton" target="_blank">Michael Hampton</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/463993/nginx-unix-domain-socket-error" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/nginx-unix-domain-socket-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
