<?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> &#187; Nginx</title>
	<atom:link href="http://www.liguosong.com/category/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.liguosong.com</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2018 01:02:19 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)</title>
		<link>http://www.liguosong.com/2016/11/14/nginx-emerg-socket-80-failed-97-address-family-not-supported-by-protocol/</link>
		<comments>http://www.liguosong.com/2016/11/14/nginx-emerg-socket-80-failed-97-address-family-not-supported-by-protocol/#comments</comments>
		<pubDate>Mon, 14 Nov 2016 03:18:34 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=596</guid>
		<description><![CDATA[centos6.5环境 yum 安装nginx后（版本nginx1.10.1） 启动报错： nginx: [e [...]]]></description>
				<content:encoded><![CDATA[<p>centos6.5环境 yum 安装nginx后（版本nginx1.10.1）</p>
<p>启动报错：</p>
<p>nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)</p>
<p>解决办法：</p>
<p>vim /etc/nginx/conf.d/default.conf</p>
<p>将</p>
<pre class="brush:other">listen       80 default_server;
listen       [::]:80 default_server;</pre>
<p>改为：</p>
<pre class="brush:other">listen       80;
#listen       [::]:80 default_server;</pre>
<p>启动nginx就行了。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2016/11/14/nginx-emerg-socket-80-failed-97-address-family-not-supported-by-protocol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx 禁止目录访问</title>
		<link>http://www.liguosong.com/2016/02/26/nginx-%e7%a6%81%e6%ad%a2%e7%9b%ae%e5%bd%95%e8%ae%bf%e9%97%ae/</link>
		<comments>http://www.liguosong.com/2016/02/26/nginx-%e7%a6%81%e6%ad%a2%e7%9b%ae%e5%bd%95%e8%ae%bf%e9%97%ae/#comments</comments>
		<pubDate>Fri, 26 Feb 2016 03:55:58 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=580</guid>
		<description><![CDATA[location ~ /folder { return 404; } &#160;]]></description>
				<content:encoded><![CDATA[<pre class="brush:bash">location ~ /folder {
    return 404;
}</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2016/02/26/nginx-%e7%a6%81%e6%ad%a2%e7%9b%ae%e5%bd%95%e8%ae%bf%e9%97%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>brew install php56</title>
		<link>http://www.liguosong.com/2015/11/04/brew-install-php56/</link>
		<comments>http://www.liguosong.com/2015/11/04/brew-install-php56/#comments</comments>
		<pubDate>Wed, 04 Nov 2015 07:43:47 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=529</guid>
		<description><![CDATA[Dupes brew tap homebrew/dupes 加入版本 brew tap homebrew/ve [...]]]></description>
				<content:encoded><![CDATA[<p>Dupes</p>
<pre class="brush:bash">brew tap homebrew/dupes</pre>
<p>加入版本</p>
<pre class="brush:bash">brew tap homebrew/versions</pre>
<p>加入PHP</p>
<pre class="brush:bash">brew tap homebrew/homebrew-php</pre>
<p>列出php5.6的选项</p>
<pre class="brush:bash">brew options php56</pre>
<p>好了，开始安装吧，go</p>
<pre class="brush:bash">brew install php56</pre>
<p>在安装的时候，没有顺利的安装成功，碰到倒了如下错误。</p>
<pre class="brush:bash"> wrong number of arguments (3 for 0..2)</pre>
<p>这个错误猜测可能是因为之前已经有安装过的PHP版本，后来把这个给删掉就好了。<a href="http://www.liguosong.com/2015/11/04/error-failed-to-update-tap-josegonzalezphp/">删除方法点击这里</a></p>
<p>安装完成之后，记得设置php的lib目录，否则在cli的模式下不能使用最新的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2015/11/04/brew-install-php56/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error: Failed to update tap: josegonzalez/php</title>
		<link>http://www.liguosong.com/2015/11/04/error-failed-to-update-tap-josegonzalezphp/</link>
		<comments>http://www.liguosong.com/2015/11/04/error-failed-to-update-tap-josegonzalezphp/#comments</comments>
		<pubDate>Wed, 04 Nov 2015 06:57:16 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=526</guid>
		<description><![CDATA[最近很久没有更新brew了，刚才执行了一下 brew update 结果出现了如下错误： Error: Fai [...]]]></description>
				<content:encoded><![CDATA[<p>最近很久没有更新brew了，刚才执行了一下</p>
<pre class="brush:bash">brew update</pre>
<p>结果出现了如下错误：</p>
<pre class="brush:bash">Error: Failed to update tap: josegonzalez/php</pre>
<p>错误原因是因为现在php的源发生了变更，所以这里出现了无法更新的问题。解决方案是可以把这个源给删掉。</p>
<pre class="brush:bash">brew untap josegonzalez/php</pre>
<p>当然，删掉之后，需要增加新的源，看一下<a href="http://www.liguosong.com/2015/11/04/brew-install-php56/">brew 升级 php56</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2015/11/04/error-failed-to-update-tap-josegonzalezphp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>升级php版本到php5.5，掉坑了。。。。</title>
		<link>http://www.liguosong.com/2014/07/16/%e5%8d%87%e7%ba%a7php%e7%89%88%e6%9c%ac%e5%88%b0php5-5%ef%bc%8c%e6%8e%89%e5%9d%91%e4%ba%86%e3%80%82%e3%80%82%e3%80%82%e3%80%82/</link>
		<comments>http://www.liguosong.com/2014/07/16/%e5%8d%87%e7%ba%a7php%e7%89%88%e6%9c%ac%e5%88%b0php5-5%ef%bc%8c%e6%8e%89%e5%9d%91%e4%ba%86%e3%80%82%e3%80%82%e3%80%82%e3%80%82/#comments</comments>
		<pubDate>Wed, 16 Jul 2014 06:31:52 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=322</guid>
		<description><![CDATA[昨天刚刚升级了系统跟php的版本。把php升级到了5.5。升完级后，感觉挺爽。 结果一会服务器就出现了502的 [...]]]></description>
				<content:encoded><![CDATA[<p>昨天刚刚升级了系统跟php的版本。把php升级到了5.5。升完级后，感觉挺爽。</p>
<p>结果一会服务器就出现了502的错误，有些懵了。。。后来经过排查，发现原来ngnix的一个配置不管用了。就是fastcgi_pass。原来是转到一个9000的端口上。升级后，可能php的配置文件变了。这个不管用了。<span id="more-322"></span>结果排查后，更改成了fastcgi_pass unix:/var/run/php5-fpm.sock;</p>
<p>ok，重启php-fpm跟ngnix。网站有些页面ok了。却出现了很多其他的错误，仔细一看，原来用的好好的mongo驱动，现在说mongo驱动不存在了。。晕啊。。</p>
<p>php -m 一看。发现很多驱动都没了。。没了。。。找到mongo.so文件，将这个文件的位置，在php.ini中的extension_dir中设置了。发现，不能解析这个.so文件。。。</p>
<p>是不是升级了php后，有些不兼容的问题？ok，那我就升级mongo吧。结果，原来的pecl install mongo的方法，不能用了。。安装失败。。</p>
<p>查了半天，也没弄明白，为什么。后来，实在没有办法了，把pear卸载了。重新安装了pear。然后卸载mongo，重新安装。这才可以使用。</p>
<p>php升级了，导致pear也不能用了。看来没事不能胡乱升级啊，真的会出问题。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2014/07/16/%e5%8d%87%e7%ba%a7php%e7%89%88%e6%9c%ac%e5%88%b0php5-5%ef%bc%8c%e6%8e%89%e5%9d%91%e4%ba%86%e3%80%82%e3%80%82%e3%80%82%e3%80%82/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx PHP 502 504</title>
		<link>http://www.liguosong.com/2013/12/31/nginx-php-502-504/</link>
		<comments>http://www.liguosong.com/2013/12/31/nginx-php-502-504/#comments</comments>
		<pubDate>Tue, 31 Dec 2013 12:39:27 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Nginx 502 504]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=216</guid>
		<description><![CDATA[在使用Nginx时，经常会碰到502 Bad Gateway和504 Gateway Time-out错误，下 [...]]]></description>
				<content:encoded><![CDATA[<p>在使用Nginx时，经常会碰到502 Bad Gateway和504 Gateway Time-out错误，下面以Nginx+PHP-FPM来分析下这两种常见错误的原因和解决方案。<span id="more-216"></span></p>
<p>1.502 Bad Gateway错误 在php.ini和php-fpm.conf中分别有这样两个配置项：max_execution_time和request_terminate_timeout。 这两项都是用来配置一个PHP脚本的最大执行时间的。当超过这个时间时，PHP-FPM不只会终止脚本的执行， 还会终止执行脚本的Worker进程。所以Nginx会发现与自己通信的连接断掉了，就会返回给客户端502错误。 以PHP-FPM的request_terminate_timeout=30秒时为例，报502 Bad Gateway错误的具体信息如下：<br />
1）Nginx错误访问日志： 2013/09/19 01:09:00 [error] 27600#0: *78887 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.101, server: test.com, request: &#8220;POST /index.php HTTP/1.1&#8243;, upstream: &#8220;fastcgi://unix:/dev/shm/php-fcgi.sock:&#8221;, host: &#8220;test.com&#8221;, referrer: &#8220;http://test.com/index.php&#8221;<br />
2）PHP-FPM报错日志：<br />
WARNING: child 25708 exited on signal 15 (SIGTERM) after 21008.883410 seconds from start<br />
所以只需将这两项的值调大一些就可以让PHP脚本不会因为执行时间长而被终止了。request_terminate_timeout可以覆盖max_execution_time， 所以如果不想改全局的php.ini，那只改PHP-FPM的配置就可以了。 此外要注意的是Nginx的upstream模块中的max_fail和fail_timeout两项。有时Nginx与上游服务器（如Tomcat、FastCGI）的通信只是偶然断掉了， 但max_fail如果设置的比较小的话，那么在接下来的fail_timeout时间内，Nginx都会认为上游服务器挂掉了，都会返回502错误。 所以可以将max_fail调大一些，将fail_timeout调小一些。</p>
<p>2.504 Gateway Time-out错误 PHP-FPM设置的脚本最大执行时间已经够长了，但执行耗时PHP脚本时，发现Nginx报错从502变为504了。这是为什么呢？ 因为我们修改的只是PHP的配置，Nginx中也有关于与上游服务器通信超时时间的配置factcgi_connect/read/send_timeout。 以Nginx超时时间为90秒，PHP-FPM超时时间为300秒为例，报504 Gateway Timeout错误时的Nginx错误访问日志如下： 2013/09/19 00:55:51 [error] 27600#0: *78877 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.1.101, server: test.com, request: &#8220;POST /index.php HTTP/1.1&#8243;, upstream: &#8220;fastcgi://unix:/dev/shm/php-fcgi.sock:&#8221;, host: &#8220;test.com&#8221;, referrer: &#8220;http://test.com/index.php&#8221; 调高这三项的值（主要是read和send两项，默认不配置的话Nginx会将超时时间设为60秒）之后，504错误也解决了。 而且这三项配置可以配置在http、server级别，也可以配置在location级别。担心影响其他应用的话，就配置在自己应用的location中吧。 要注意的是factcgi_connect/read/send_timeout是对FastCGI生效的，而proxy_connect/read/send_timeout是对proxy_pass生效的。 配置举例： location ~ \.php$ { root /home/cdai/test.com;</p>
<p>include fastcgi_params;<br />
fastcgi_connect_timeout 180;<br />
fastcgi_read_timeout 600;<br />
fastcgi_send_timeout 600;<br />
fastcgi_pass unix:/dev/shm/php-fcgi.sock;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME /home/cdai/test.com$fastcgi_script_name; }</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2013/12/31/nginx-php-502-504/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
