apache用http://就可以正常访问到项目,https:访问的显示的是 It Works!页面

问题

使用阿里云的服务器部署网站是 http://oldthree.top,现在有需求将其转换为https://oldthree.top,主要是为了微信小程序的连接测试工作.
在使用阿里云的证书进行相关配置之后,打开https://oldthree.top 显示的是”It Works” 界面:
Itworks

解决办法

将https下的路径与http下的路径一致.就需要修改apache中的配置文件:
我的修改的文件夹路径是usr/local/apache56/conf/original/extra/httpd-ssl.conf 其中,usr/local/apache56 是我apache的安装路径,在其安装路径下.有conf/original/extra/http-ssl.conf 文件,修改其

DocumentRoot "/usr/local/apache56/htdocs"
//变更为:
DocumentRoot "/data/wwwroot/default"
//此地址为你服务器默认网页地址
//也就是修改下图的125行

ssl.png
同时,修改usr/local/apache56/conf/original/httpd.conf文件的相关位置:大概是在235行左右:
origin/http.conf文件
修改为:

DocumentRoot "/data/wwwroot/default"
<Directory "/data/wwwroot/default">

也就是服务器默认网页地址,跟上文中相同.
将217行左右的:

<Directory />
    AllowOverride none
    Require all denied
</Directory>
// 256行左右的:
    AllowOverride None

修改为:

<Directory />
    AllowOverride All
    Require all denied
    Header set Access-Control-Allow-Origin *
</Directory>
// 256行左右的的:
AllowOverride All

猜你喜欢

转载自blog.csdn.net/peng_9/article/details/78841240