Skip to content

Apache: Reverse proxy to a website in a virtual machine with HTTPS #16249

Answered by Verhoeckx
Verhoeckx asked this question in Q&A
Discussion options

You must be logged in to vote

Yes it works!

I installed the SSL-certificate on the host (with Let's Encrypt) and now it works correctly 🥳 !!

Here is the final virtual host file:

ServerName localhost
DocumentRoot /var/www/html/

<VirtualHost *:80 >
    ServerName [your.domain.com]
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =[your.domain.com]
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443 >
    ServerName [your.domain.com]
    ProxyPreserveHost On
    ProxyPass / http://[IP address virtual machine]/
    ProxyPassReverse / http://[IP address virtual machine]/
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/[your.domain.com]/fullchain.p…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Verhoeckx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant