<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[张宴的博客]]></title> 
<link>http://zyan.cc/index.php</link> 
<description><![CDATA[Web系统架构与底层研发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[张宴的博客]]></copyright>
<item>
<link>http://zyan.cc/post/337/</link>
<title><![CDATA[解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[Web服务器]]></category>
<pubDate>Thu, 10 Apr 2008 04:50:30 +0000</pubDate> 
<guid>http://zyan.cc/post/337/</guid> 
<description>
<![CDATA[ 
	　　Apache、IIS、Nginx等绝大多数web服务器，都不允许静态文件响应POST请求，否则会返回“HTTP/1.1 405 Method not allowed”错误。<br/><br/>　　例1：用Linux下的curl命令发送POST请求给Apache服务器上的HTML静态页<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@new-host ~]# curl -d 1=1 <A href="http://www.sohu.com/index.html"><a href="http://www.sohu.com/index.html" target="_blank">http://www.sohu.com/index.html</a></A><br/>&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;<br/>&lt;HTML&gt;&lt;HEAD&gt;<br/>&lt;TITLE&gt;405 Method Not Allowed&lt;/TITLE&gt;<br/>&lt;/HEAD&gt;&lt;BODY&gt;<br/>&lt;H1&gt;Method Not Allowed&lt;/H1&gt;<br/>The requested method POST is not allowed for the URL /index.html.&lt;P&gt;<br/>&lt;HR&gt;<br/>&lt;ADDRESS&gt;Apache/1.3.37 Server at <A href="http://www.sohu.com"><a href="http://www.sohu.com" target="_blank">www.sohu.com</a></A> Port 80&lt;/ADDRESS&gt;<br/>&lt;/BODY&gt;&lt;/HTML&gt;</font></div><br/><br/>　　例2：用Linux下的curl命令发送POST请求给Nginx服务器上的HTML静态页<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@new-host ~]# curl -d 1=1 <A href="http://blog.zyan.cc/tech/index.htm"><a href="http://blog.zyan.cc/tech/index.htm" target="_blank">http://blog.zyan.cc/tech/index.htm</a></A><br/>&lt;html&gt;<br/>&lt;head&gt;&lt;title&gt;405 Not Allowed&lt;/title&gt;&lt;/head&gt;<br/>&lt;body bgcolor="white"&gt;<br/>&lt;center&gt;&lt;h1&gt;405 Not Allowed&lt;/h1&gt;&lt;/center&gt;<br/>&lt;hr&gt;&lt;center&gt;nginx/0.5.35&lt;/center&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;</font></div><br/><br/>　　但在有些应用中，需要使静态文件能够响应POST请求。<br/><br/>　　对于Nginx，可以修改nginc.conf配置文件，改变“405错误”为“200 ok”，并配置location来解决，方法如下：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">server<br/>&#123;<br/> &nbsp; &nbsp;listen &nbsp; &nbsp; &nbsp; 80;<br/> &nbsp; &nbsp;server_name &nbsp;domain.zyan.cc;<br/> &nbsp; &nbsp;index index.html index.htm index.php;<br/> &nbsp; &nbsp;root &nbsp;/opt/htdocs;<br/><br/> &nbsp; &nbsp;if (-d $request_filename)<br/> &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp;rewrite ^/(.*)([^/])$ <a href="http://$host/$1$2/" target="_blank">http://$host/$1$2/</a> permanent;<br/> &nbsp; &nbsp;&#125;<br/><br/> &nbsp; &nbsp;error_page &nbsp; 405 =200 @405;<br/> &nbsp; &nbsp;location @405<br/> &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp;root &nbsp;/opt/htdocs;<br/> &nbsp; &nbsp;&#125; &nbsp; &nbsp; <br/> <br/> &nbsp; &nbsp;location ~ .*&#92;.php?$<br/> &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp;include conf/fcgi.conf; &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_pass &nbsp;127.0.0.1:10080;<br/> &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_index index.php;<br/> &nbsp; &nbsp;&#125;<br/>&#125;</div><br/><br/>Tags - <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/nginx/" rel="tag">nginx</a> , <a href="http://zyan.cc/tags/html/" rel="tag">html</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment938</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>bighearted &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 10 Apr 2008 12:05:17 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment938</guid> 
<description>
<![CDATA[ 
	不错，空间速度今天很慢啊
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment955</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>easylife &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 17 Apr 2008 00:08:07 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment955</guid> 
<description>
<![CDATA[ 
	帅哥，能否说说什么应用需要向静态页发送post请求。多谢。
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment2176</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>小弟 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 09 Dec 2008 09:58:50 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment2176</guid> 
<description>
<![CDATA[ 
	张老师请问你BLOG租用的那个服务器是哪个提供商的啊 我也想去租一个 虚拟机的把
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment2607</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>reibill &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 19 Feb 2009 05:12:23 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment2607</guid> 
<description>
<![CDATA[ 
	张老师，您好，我按照你的配置，修改了nginx.conf,用nginx -t测试了配置文件，没有语法错误，但是，我用curl进行测试的时候，还是报告405错误，似乎并没有重定向成功，配置和您的一样，就是root那里改了。<br/> &nbsp; error_page &nbsp; 405 =200 @405;<br/> &nbsp; location @405<br/> &nbsp; &#123;<br/> &nbsp; &nbsp; &nbsp; root &nbsp;/home/nemo/htdocs;<br/> &nbsp; &#125; <br/>在access.log里面依旧显示405，我有重启过nginx的程序。
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment3356</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>hi &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 27 May 2009 06:33:10 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment3356</guid> 
<description>
<![CDATA[ 
	按照这个配置还是一样提示405错误
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment3754</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>hello &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 29 Jul 2009 00:59:39 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment3754</guid> 
<description>
<![CDATA[ 
	这个方法没效果，依旧是405错误
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment5762</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>psit &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 26 Apr 2010 09:03:55 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment5762</guid> 
<description>
<![CDATA[ 
	看看
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment6466</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>峻泽 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 27 Jul 2010 13:05:27 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment6466</guid> 
<description>
<![CDATA[ 
	这个方法不行啊！！还是405 Not Allowed！！！
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment8453</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>OUYANG &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 07 Jun 2011 08:21:57 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment8453</guid> 
<description>
<![CDATA[ 
	不行呀
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment8606</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>btweng &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 06 Jul 2011 07:49:23 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment8606</guid> 
<description>
<![CDATA[ 
	编辑nginx源代码<br/>[root@new-host ~]# vim src/http/modules/ngx_http_static_module.c<br/>修改： 找到下面一段注释掉<br/>/*if (r-&gt;method &amp; NGX_HTTP_POST) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return NGX_HTTP_NOT_ALLOWED;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;*/<br/>然后按照原来的编译参数，重新编译安装nginx，即可
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment9299</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>cnrainbing &lt;rainbing@live.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 08 Sep 2011 09:48:23 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment9299</guid> 
<description>
<![CDATA[ 
	张老师很给力啊支持
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment14199</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>louis vuitton uk &lt;fsf@fdg.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 23 Nov 2011 00:59:23 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment14199</guid> 
<description>
<![CDATA[ 
	This <a href="http://www.louisvuittonoutlets.org.uk" target="_blank">louis vuitton uk</a> for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this <a href="http://www.coachoutletstoreonlinefree.com" target="_blank">coach outlet store online</a>. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine <a href="http://www.christian-louboutinsale.org.uk" target="_blank">christian louboutin sale</a>. Purse the elegance in bridal wedding. Enjoy the fashion.
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment16360</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>糖尿病足 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 12 Mar 2012 07:28:09 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment16360</guid> 
<description>
<![CDATA[ 
	我来看看博主
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment17367</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>chanel uk &lt;xiang1234xiangxiang@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 13 Apr 2012 09:32:27 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment17367</guid> 
<description>
<![CDATA[ 
	<a href="http://www.christianlouboutinukuk.org" target="_blank">christian louboutin</a><br/><a href="http://www.tiffanyuksuk.org" target="_blank">tiffanys</a><br/><a href="http://www.gucciukbeltuk.org" target="_blank">gucci uk</a><br/><a href="http://www.frsaclouisvuittonsac.com" target="_blank">louis vuitton sac</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/337/#blogcomment17390</link>
<title><![CDATA[[评论] 解决“HTTP/1.1 405 Method not allowed”问题，让静态文件响应POST请求[原创]]]></title> 
<author>chanel uk &lt;xiang1234xiangxiang@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 13 Apr 2012 09:38:01 +0000</pubDate> 
<guid>http://zyan.cc/post/337/#blogcomment17390</guid> 
<description>
<![CDATA[ 
	<a href="http://www.chanelukoutlets.org.uk" target="_blank">chanel uk</a><br/><a href="http://www.burberryukoutletuk.org" target="_blank">burberry uk</a><br/><a href="http://www.poloralphlaurenuks.org" target="_blank">ralph lauren uk</a>
]]>
</description>
</item>
</channel>
</rss>