【问题标题】:Apache server returns 200 responseApache 服务器返回 200 响应
【发布时间】:2015-11-18 12:24:52
【问题描述】:

我有 2 台不同的 centos 服务器(与 6.7 版相同),并且我已经为两台服务器安装了 apache 2.2.15。问题是我可以在 test1 服务器上连接到我的网站,但我无法在 test2 服务器上连接到我的网站。这是两台服务器的 wget 结果。有没有办法解决这个问题?

[root@test1 ~]# wget localhost
--2015-11-18 14:01:45--  http://localhost/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: /login/mainpage/ [following]
--2015-11-18 14:01:45--  http://localhost/login/mainpage/
Reusing existing connection to localhost:80.
HTTP request sent, awaiting response... 200 OK
Length: 7987 (7.8K) [text/html]
Saving to: “index.html”

100%[======================================>] 7,987       --.-K/s   in 0s

2015-11-18 14:01:46 (396 MB/s) - “index.html” saved [7987/7987]



[root@test2 /]# wget localhost
--2015-11-18 14:10:47--  http://localhost/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4 [text/html]
Saving to: “index.html”

100%[======================================>] 4           --.-K/s   in 0s

2015-11-18 14:11:17 (666 KB/s) - “index.html” saved [4/4]

【问题讨论】:

    标签: php html apache


    【解决方案1】:

    看起来连接在这两种情况下都有效。

    在这两种情况下,您最终都会得到一个 200 响应代码和文件 index.html

    唯一的区别是,在第一个测试用例中,您的网络服务器执行从 http://localhosthttp://localhost/login/mainpage 的 302 重定向。然后从那里返回index.html

    这可能是在您的 .htaccess 文件中设置的内容。

    【讨论】:

    • 问题是两个服务器都有相同的 php 和 .htaccess 文件。 test1 服务器返回我网站的 index.html 文件,但 test2 服务器返回空白 index.html 文件。
    • @hellzone,不同的 .confvirtualhost 文件?
    猜你喜欢
    • 1970-01-01
    • 2019-06-29
    • 1970-01-01
    • 2016-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-10
    • 2017-07-25
    相关资源
    最近更新 更多