I have an Apache server installed in Debian VPS, i used it as a proxy reverse to a Nginx container contains static website, I mapped the container's port 80 to 3002 and its working well, but i have a problem when i access https://www.example.com it redirect me to http://www.example.com :! I set my vhosts like that:
the first 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>
the second vHost (HTTPS created by Letencrypt Bot)
<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>
Note : docker image is kyma/docker-nginx
You need an alias for www:
ServerName: example.com
ServerAlias: www.example.com
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.