Https,端口443,需要SSL证书(自行申请)
检查容器对外开放443端口是否映射正常
docker ps
进入容器内http服务,这里使用的apache2的httpd服务
docker exec -it test bash
cd /etc/apache2/sites-available/
查看Apache配置文件,配置相应443端口转发(原80普通http)
vi /etc/apache2/sites-available/000-default.conf
<Directory>
RewriteEngine on
RewriteBase /
# FORCE HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
/Directory>
查看Apache配置文件,找到SSL证书路径(/etc/ssl)
vi /etc/apache2/sites-available/default-ssl.conf
配置对应到对应ssl证书路径
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
重启容器
docker restart test