5

首先,只是让您知道我对 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>

出于某种原因,唯一有效的虚拟主机是 443 虚拟主机。当我试图在没有它的情况下访问网站时,https://它给了我这个错误:

此网页无法使用

ERR_ADDRESS_UNREACHABLE

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

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

谢谢!

4

1 回答 1

11

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

如果您没有看到httpinservices:80/tcpinports:那么您需要向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:
于 2016-05-25T11:11:50.270 回答