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

有人可能会问我为什么不做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服务器,一切正常。


---------------------
作者:andos
来源:CSDN
原文:https://blog.csdn.net/Andos/article/details/11484771
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/hgd95/article/details/84969626