Last active
March 18, 2025 20:55
-
-
Save fvoska/4c801ccf005368d8ae91256a361c9b96 to your computer and use it in GitHub Desktop.
Apache reverse proxy configuration for Node.js with Let's Encrypt SSL/TLS certificate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a2ensite subdomain.me.com.conf | |
a2ensite subdomain.me.com.ssl.conf | |
service apache2 reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node.js app listens on 8080 for HTTP. It doesn't need to listen for HTTPS. | |
In firewall, allow port 8080 only on localhost interface. | |
Let's encrypt certificate is created for subdomain.me.com and stored in /home/USER/letsencrypt/etc/live/subdomain.me.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/apache2/sites-available/subdomain.me.com.conf | |
<VirtualHost *:80> | |
ServerName subdomain.me.com | |
<Location "/"> | |
ProxyPreserveHost On | |
ProxyPass http://localhost:8080/ | |
ProxyPassReverse http://localhost:8080/ | |
</Location> | |
# If you want to redirect HTTP to HTTPS, remove <Location> above and add Redirect: | |
# Redirect permanent / https://subdomain.me.com/ | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/apache2/sites-available/subdomain.me.com.ssl.conf | |
<VirtualHost *:443> | |
ServerName subdomain.me.com | |
SSLEngine on | |
SSLCertificateFile /home/USER/letsencrypt/etc/live/subdomain.me.com/fullchain.pem | |
SSLCertificateKeyFile /home/USER/letsencrypt/etc/live/subdomain.me.com/privkey.pem | |
<Location "/"> | |
ProxyPreserveHost On | |
ProxyPass http://localhost:8080/ | |
ProxyPassReverse http://localhost:8080/ | |
</Location> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tutorial dos deuses? vou testar