【问题标题】:CentOS HTTPD SSL 404 errorCentOS HTTPD SSL 404 错误
【发布时间】:2016-07-03 04:28:42
【问题描述】:

我在 VMWare 上全新安装了 Linux CentOS。我的路由器中的 80 和 443 端口是开放的。为了限制可能出现的问题,我暂时禁用了 SELinux,并停止了 iptables 服务。

我已按照文章中关于使用 CentOS 设置 SSL 安全 Web 服务器的说明进行操作:https://wiki.centos.org/HowTos/Https

以下是我对默认 ssl.conf 文件所做的唯一更改:

  • 更改服务器名称以列出我的服务器名称
  • 以我的 .crt 文件的名称修改 SSLCertificateFile
  • 使用我的 .key 文件的名称修改了 SSLCertificateKeyFile

.

<VirtualHost _default_:443>
 ServerName www.example.com
 SSLCertificateFile /etc/pki/tls/certs/example.crt
 SSLCertificateKeyFile /etc/pki/tls/private/example.key
</VirtualHost>

使用局域网中的任何计算机,我都可以从我的 HTTPD Web 服务器获取 HTTP(80) 和 HTTPS(443) 网页。在不同网络上使用计算机时,我可以获得 HTTP(80) 页面。但是,HTTPS(443) 页面会产生“error 404 the requested resource is not found。”

使用不同网络中的计算机获取 HTTP(80) 页面,我在此日志中看到连接:

  • /var/log/httpd/access_log

使用不同网络中的计算机请求 HTTPS(443) 页面,这些日志不包含任何新事件:

  • /var/log/httpd/access_log
  • /var/log/httpd/error_log
  • /var/log/httpd/ssl_request_log
  • /var/log/httpd/ssl_access_log

客户端上的 Wireshark 捕获不显示任何相关的 HTTP(80)、HTTPS(443) 或 SSL 数据包。

由于在请求 HTTPS(443) 网页时日志没有显示事件,而且 Wireshark 也没有捕获数据包,所以我不确定下一步该去哪里诊断这个问题。如果有任何关于诊断问题的提示或建议,我将不胜感激。

【问题讨论】:

  • 你有默认主页吗?当我没有向网站添加“index.html”时,我也看到过类似的情况。如果没有其他解决方案,可以在howtoforge.com 找到设置说明的替代方法
  • @mcalex,非常感谢您提醒确保 /var/www/html 包含文件 index.html。我确实有 index.html 文件。也非常感谢您访问完美 CentOS 服务器上的 howtoforce.com 页面。哇,好棒的资源。我将逐步浏览 howtoforge 页面,看看是否可以找到解决我面临的问题的提示。我非常感谢这里的提示!

标签: apache ssl centos http-status-code-404


【解决方案1】:

我能够解决这个问题。本文中的说明提供了修复:https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-httpd-secure-server.html

原来我的 ssl.conf 文件的域名中没有 www 或 .com,像这样:

<VirtualHost _default_:443>
 ServerName www.example.com
 SSLCertificateFile /etc/pki/tls/certs/example.crt
 SSLCertificateKeyFile /etc/pki/tls/private/example.key
</VirtualHost>

我注意到在 CentOS 文档中使用了 www 和 .com。我创建了一个新的证书和私钥,然后更新了 ssl.conf 文件。

<VirtualHost _default_:443>
 ServerName www.example.com
 SSLCertificateFile /etc/pki/tls/certs/www.example.com.crt
 SSLCertificateKeyFile /etc/pki/tls/private/www.example.com.key
</VirtualHost>

现在我在远程网络上请求网页时不再收到错误 404。这告诉我,证书、私钥和 ssl.conf 文件的格式有特定的要求。

【讨论】:

    猜你喜欢
    • 2021-02-14
    • 2015-02-27
    • 2015-04-06
    • 2015-08-24
    • 2018-02-01
    • 2017-02-20
    • 2012-06-30
    • 2017-11-21
    • 2015-11-20
    相关资源
    最近更新 更多