让apache服务器可以保证http和https同时访问(解决https可以访问而http不能访问)

  • 作者:沈清标
  • PHP
  • 时间:2019-01-10
  • 3530人已阅读
简介

有人可能会问我为什么不做rewrite,但是我的情况是apache下有多个网站,只有一个网站需要https,本人也无法想到如何用rewrite解决这样的情况

该文的基础建立在https已经可以访问,而http无法访问的情况下

打开配置ssl的配置文件(由于apache版本以及各种原因,该文件名字不一样)

加入以下几行在前面

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>


重启apache服务器,一切正常。

 
Top