日期:2014-05-16  浏览次数:20908 次

apache 很奇怪的问题!GET访问返回301 Moved Permanently,POST访问返回It works!
本帖最后由 333sunshine 于 2012-05-13 14:13:46 编辑 系统环境centos 5.5
apache 2.2.22
====================
安装好apache后,
使用IP地址测试结果如下:

GET http://IP地址/
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
> Host: IP地址
Request sent. 215 bytes
Data available. 224/224 bytes
< HTTP/1.1 301 Moved Permanently
< Location: http://127.0.0.1
< Content-Type: text/html; charset=iso-8859-1
< Content-length: 224

301 Request complete
使用GET命令访问,返回HTTP/1.1 301 Moved Permanently
--------------------------
POST http://IP地址/
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
> Host: IP地址
Request sent. 235 bytes
Data available. 47/47 bytes
< HTTP/1.1 200 OK
< Date: Sun, 13 May 2012 06:04:37 GMT
< Server: Apache/2.2.22 (Unix)
< Last-Modified: Sun, 13 May 2012 05:41:29 GMT
< ETag: "1d98098-2f-4bfe46bceb440"
< Accept-Ranges: bytes
< Content-Length: 47
< Keep-Alive: timeout=5, max=100
< Connection: Keep-Alive
< Content-Type: text/html 
200 Request complete 
使用POST命令访问,返回<html><body><h1>It works !!!</h1></body></html>
===============================================

apache httpd.conf
-------------------------
 
ServerRoot "/program/httpd"
 
Listen 80
 

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
 
User daemon
Group daemon

</IfModule>
</IfModule>
 
ServerAdmin you@example.com
  
DocumentRoot "/program/httpd/htdocs"
 
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
 
<Directory "/program/httpd/htdocs"> 
    Options Indexes FollowSymLinks 
    AllowOverride None
 
    Order allow,deny
    Allow from all

</Directory>

 
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
 
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
 
ErrorLog "logs/error_log"
 
LogLevel warn

<IfModule log_config_module>
   
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat&n