没有https访问我的网站时ERR_ADDRESS_UNREACHABLE

时间:2016-05-25 09:19:39

标签: apache centos7 conf.d

首先,让您知道我对Web服务器有一点经验,因此,我的问题可能是非常新手。

我遇到了新创建的网站的问题。 我有另一个网站的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://的情况下访问该网站时,它会给我这个错误:

  

此网页不可用

     

ERR_ADDRESS_UNREACHABLE

是否有其他配置我不知道这会禁用不安全的流量?

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

谢谢!

1 个答案:

答案 0 :(得分:6)

验证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:

如果您在httpservices:80/tcp未看到ports:,则需要向您的区域添加http服务:< / p>

[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: