apache - CentOS HTTPD SSL 404 错误

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

我在 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) 页面会产生“错误 404 未找到所请求的资源。”

enter image description here

使用不同网络中的计算机获取 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 也没有捕获数据包,所以我不确定下一步该去哪里诊断这个问题。如果对诊断问题的方法有任何提示或建议,我将不胜感激。

最佳答案

我能够解决这个问题。本文中的说明提供了修复: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文件的格式有特定的要求。

关于apache - CentOS HTTPD SSL 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36050140/

相关文章:

php - SELinux 阻止 php 的 exec ('kill pid' ) 日志中没有任何错误

java - 如何禁用Apache JServ协议(protocol)服务

php - 部署独立的 PHP/MySQL 应用程序

apache - 如何让 Apache 将某些请求复制到另一个网络服务器?

linux - 文件夹需要身份验证

android - 导致 Android 应用程序出现问题的 SSL 证书

ssl - IBM Worklight 如何实现 HTTPS Adapter?

centos - pg gem 安装失败,找不到 libpq-fe.h header

windows - DSC Pull 服务器无法注册 Windows 10 (1709) 客户端

networking - 如何从外部访问内部?