Apache配了https之后页面打开就下载源文件,原因是没有打开对443端口的监听 。
要会看errorlog 。
这个是免费https证书,在阿里云申请的,感谢阿里云。
注意: 如果是 无域名管理权限有服务器管理权限。选 可TXT文本进行上传验证
下一步,下载一个文件放到服务器上对应的目录 ,点【验证】
如果是在windows下,直接创建.well-known有难度,可以在命令行里创建
把文件下载下来放好后,点【验证】:
验证通过之后,点【提交审核】
还有一个步骤,
过一会,收到阿里云短信通知,可以下载证书了
下载一个压缩包,里面是这样的:
可以把这3个证书文件放到apache根目录下的cert目录
然后到apache下增加conf配置文件
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "cert/3768708_your.com_public.crt"
SSLCertificateKeyFile "cert/3768708_your.com.key"
SSLCertificateChainFile "cert/3768708_your.com_chain.crt"
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
DocumentRoot "D:/php_projects/psi"
ServerName your.com
ServerAlias
FcgidInitialEnv PHPRC "D:/phpstudy_pro/Extensions/php/php7.3.4nts"
AddHandler fcgid-script .php
FcgidWrapper "D:/phpstudy_pro/Extensions/php/php7.3.4nts/php-cgi.exe" .php
<Directory "D:/php_projects/psi">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
DirectoryIndex index.php index.html error/index.html
</Directory>
ErrorDocument 400 /error/400.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 500 /error/500.html
ErrorDocument 501 /error/501.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html
ErrorDocument 504 /error/504.html
ErrorDocument 505 /error/505.html
ErrorDocument 506 /error/506.html
ErrorDocument 507 /error/507.html
ErrorDocument 510 /error/510.html
</VirtualHost>
这个版本的apache居然搞了个Listen.conf,要在这里加上Listen 443
注意: 如果之前没有开启443端口监听,那么重启apache服务器之后还是无法打开网页,会下载源代码,要清空浏览器缓存才行