ERR_ADDRESS_UNREACHABLE 在没有 https 的情况下访问我的网站时

ERR_ADDRESS_UNREACHABLE when accessing my website without https

首先,让你知道我对网络服务器有一点经验,因此,我的问题可能是新手。

我在使用新创建的网站时遇到问题。 我有一个用于另一个网站的 CentOS 7 服务器,我想向该服务器添加一个具有不同 URL 的新网站。

据我了解,网站的配置在 /etc/httpd/conf.d.

我为我的网站创建了一个新的 .conf 文件:

    <VirtualHost *:443>

    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

    #SSLCertificateFile      /etc/pki/tls/certs/localhost.crt
    #SSLCertificateKeyFile   /etc/pki/tls/private/localhost.key
    #SSLCACertificateFile    /etc/pki/tls/certs/ca-bundle.trust.crt

    SSLCertificateFile      /etc/letsencrypt/live/******/cert.pem
    SSLCertificateKeyFile   /etc/letsencrypt/live/******/privkey.pem
    #SSLCACertificateFile   /etc/letsencrypt/live/******/chain.pem
    SSLCACertificateFile    /etc/letsencrypt/live/******/fullchain.pem

    ServerName      mywebsite.com
    DocumentRoot    /var/www/myproject

    ErrorLog /var/log/httpd/ssl-mywebsite.com-error_log
    # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
    LogLevel error
    CustomLog /var/log/httpd/ssl-mywebsite.com-access_log combined

    <Directory /var/www/myproject>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName mywebsite.com
    DocumentRoot /var/www/myproject

    <Directory /var/www/myproject>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/mywebsite.com-error.log
    LogLevel warn
    CustomLog /var/log/httpd/mywebsite.com-access.log combined
</VirtualHost>

出于某种原因,唯一可用的 VirtualHost 是 443。当我试图在没有 https:// 的情况下访问该网站时,它给我这个错误:

This webpage is not available

ERR_ADDRESS_UNREACHABLE

是否有我不知道的另一种配置禁用了不安全的流量?

如果需要更多详细信息,请告诉我,我会提供。

谢谢!

验证 CentOS7 防火墙是否阻止了 http 流量:

[root@stage2 ~]# firewall-cmd --list-all
public (default, active)
  interfaces: eno16777984
  sources:
  services: dhcpv6-client https ssh
  ports: 5000/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

如果您在 services: 中没有看到 http,或者在 ports: 中没有看到 80/tcp,那么您需要向您的区域添加一个 http 服务:

[root@stage2 ~]# firewall-cmd --permanent --zone=public --add-service=http
success

之后重新加载您的防火墙以访问您的新服务:

[root@stage2 ~]# firewall-cmd --reload
success

并确认 http 已打开:

[root@stage2 ~]# firewall-cmd --list-all
public (default, active)
  interfaces: eno16777984
  sources:
  services: dhcpv6-client http https ssh
  ports: 5000/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules: