我创建了一个反向代理来访问Docker容器。现在,每当我向局域网上的服务器ip请求时,我都会重定向到为docker容器设置的域。
如果我请求http://ipaddress,我会得到https://sub.domain.com
甚至更陌生的是,如果我a2dissite sub.domain.com.conf
和systemctl reload apache2
,这种行为仍然继续
.conf用于容器反向代理
<VirtualHost *:80>
ServerName sub.domain.com
Redirect permanent / https://sub.domain.com/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /path/to/fullchain.pem
SSLCertificateKeyFile /path/to/privkey.pem
SSLProxyEngine on
ServerName sub.domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass / http://localhost:4040/
ProxyPassReverse / localhost:4040/
RequestHeader set X-Forwarded-Proto "https"
</VirtualHost>