本次实验背景:
完全参考官方 https://cloud.tencent.com/document/product/400/4143 文档流程,没有搞定,于是写下避坑之作。
服务器:腾讯云轻量应用服务器
操作系统: Windows Server 2022 DataCenter 64bit CN
apache版本:Apache 2.4.59
#LoadModule ssl_module modules/mod_ssl.so
#Include conf/extra/httpd-ssl.conf
2. 将httpd-ssl.conf中虚拟机部分代码注释
打开Apache24\conf\extra\目录,将httpd-vhosts.conf复制一份备份,清空httpd-vhosts.conf内容加入下面内容,*****包含作者真实域名信息,打了马赛克。
DocumentRoot "C:\WF\www\html\****"
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
DocumentRoot "C:\WF\www\html\****"
ServerName ****.com
ServerAlias www.****.com
#ssl
SSLEngine on
SSLOptions +StdEnvVars
SSLOptions +StdEnvVars
#ssl-key
SSLCertificateFile "${SRVROOT}/conf/ssl/****.com.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/ssl/****.com.key"
SSLCertificateChainFile "${SRVROOT}/conf/ssl/root_bundle.crt"
#ssl-key-END
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a
# compact non-error SSL logfile on a virtual host basis.
CustomLog "${SRVROOT}/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
net stop apache
httpd -t
net start apache