Last active
November 10, 2020 03:57
-
-
Save bryanmylee/2df50fc6ef9a3c7dbfe8f2d4ff2788fa to your computer and use it in GitHub Desktop.
Configuring Apache to handle HTTPS and act as a proxy for other services
This file contains hidden or 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
# If HTTPS is required on any project, this is a simple way | |
# of encrypting the connection without modifying the project. | |
# Add these settings to /etc/httpd/conf/httpd.conf | |
# Redirect HTTP requests to HTTPS and rewrite the URL | |
Listen 80 | |
<VirtualHost *:80> | |
ServerName "ryver.life" | |
ServerAlias "www.ryver.life" | |
RewriteEngine on | |
RewriteCond %{SERVER_NAME} =ryver.life [OR] | |
RewriteCond %{SERVER_NAME} =www.ryver.life | |
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] | |
</VirtualHost> | |
# Decrypt the HTTPS connection and proxy it to another port on the machine | |
<VirtualHost *:443> | |
ProxyPreserveHost On | |
ProxyRequests Off | |
ServerName "ryver.life" | |
ServerAlias "www.ryver.life" | |
ProxyPass / http://localhost:8080/ | |
ProxyPassReverse / http://localhost:8080/ | |
SSLEngine on | |
SSLCertificateFile /etc/letsencrypt/live/ryver.life/cert.pem | |
SSLCertificateKeyFile /etc/letsencrypt/live/ryver.life/privkey.pem | |
SSLCACertificateFile /etc/letsencrypt/live/ryver.life/fullchain.pem | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment