我在Debian VPS中安装了Apache服务器,我将其用作与包含静态网站的Nginx容器相反的代理,我将容器的端口80映射到3002且其工作正常,但是当我访问{ {3}}会将我重定向到https://www.example.com!我将我的虚拟主机设置为:
第一个vHost(HTTP)
<VirtualHost *:80>
ServerName example.com
<Location />
Order allow...
</Location>
ProxyRequests Off
ProxyPreserveHost On
#proxy to docker nginx -p 3002:80
ProxyPass / http://localhost:3002
ProxyPassReverse / http://localhost:3002
</VirtualHost>
第二个vHost(由Letencrypt Bot创建的HTTPS)
<VirtualHost *:443>
ServerName example.com
<Location />
Order allow...
</Location>
ProxyRequests Off
ProxyPreserveHost On
#proxy to docker nginx -p 3002:80
ProxyPass / http://localhost:3002
ProxyPassReverse / http://localhost:3002
#crt files..
SSLCertificateFile /etc/letsen...
SSLCertificateKeyFile /etc/letsen..
Include /etc/letsencrypt/option...
</VirtualHost>
注意:Docker映像为kyma / docker-nginx
答案 0 :(得分:0)
您需要www的别名:
ServerName: example.com
ServerAlias: www.example.com