Difference between revisions of "WebServer - Proxy VirtualHost Configuration"
Jump to navigation
Jump to search
(Created page with "An Example: * FQDN being proxied ** Test.Domain.Net * Internal server FQDN ** Server.LocalDomain.net ######################### # Test.Domain.Net # ####################...") |
|||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
An Example: | An Example: | ||
| − | * FQDN being proxied | + | |
| − | ** Test.Domain.Net | + | *[[WikiPedia:Fully qualified domain name|FQDN]] being proxied |
| − | * Internal server FQDN | + | **'''Test.Domain.Net''' |
| − | ** Server.LocalDomain.net | + | *Internal server [[WikiPedia:Fully qualified domain name|FQDN]] |
| + | **'''Server.LocalDomain.net''' | ||
######################### | ######################### | ||
| − | # Test.Domain.Net | + | # Test.Domain.Net # |
######################### | ######################### | ||
| + | # Proxy the local machine name for completeness | ||
<VirtualHost *:80> | <VirtualHost *:80> | ||
ServerName Server.LocalDomain.net | ServerName Server.LocalDomain.net | ||
| − | Redirect permanent / https://Test.Domain.Net/ | + | Redirect permanent / <nowiki>https://Test.Domain.Net/</nowiki> |
</VirtualHost> | </VirtualHost> | ||
| + | # Enforce use of SSL | ||
<VirtualHost *:80> | <VirtualHost *:80> | ||
ServerName Test.Domain.Net | ServerName Test.Domain.Net | ||
| − | Redirect permanent / https://Test.Domain.Net/ | + | Redirect permanent / <nowiki>https://Test.Domain.Net/</nowiki> |
</VirtualHost> | </VirtualHost> | ||
| + | # The actual proxy definition | ||
<VirtualHost _default_:443> | <VirtualHost _default_:443> | ||
ServerName Test.Domain.Net | ServerName Test.Domain.Net | ||
| Line 27: | Line 31: | ||
# Redirect HTTPS traffic | # Redirect HTTPS traffic | ||
| − | ProxyPass / https://Server.LocalDomain.net/ | + | ProxyPass / <nowiki>https://Server.LocalDomain.net/</nowiki> |
| − | ProxyPassReverse / https://Server.LocalDomain.net/ | + | ProxyPassReverse / <nowiki>https://Server.LocalDomain.net/</nowiki> |
SSLCertificateFile /etc/letsencrypt/live/Test.Domain.Net/fullchain.pem | SSLCertificateFile /etc/letsencrypt/live/Test.Domain.Net/fullchain.pem | ||
| Line 36: | Line 40: | ||
Allow from all | Allow from all | ||
</Proxy> | </Proxy> | ||
| − | + | ErrorLog /var/log/apache2/Proxy/TDN.log | |
| − | + | CustomLog /var/log/apache2/Proxy/TDN-access.log combined | |
</VirtualHost> | </VirtualHost> | ||
| + | |||
| + | This can be placed in a file in <code>/etc/apache2/sites-available</code> (And, of course, linked into <code>/etc/apache2/sites-enabled</code>). It could also be simply added to <code>/etc/apache2/apache2.conf</code> If you want to do it that way... | ||
Latest revision as of 13:07, 15 July 2020
An Example:
#########################
# Test.Domain.Net #
#########################
# Proxy the local machine name for completeness
<VirtualHost *:80>
ServerName Server.LocalDomain.net
Redirect permanent / https://Test.Domain.Net/
</VirtualHost>
# Enforce use of SSL
<VirtualHost *:80>
ServerName Test.Domain.Net
Redirect permanent / https://Test.Domain.Net/
</VirtualHost>
# The actual proxy definition
<VirtualHost _default_:443>
ServerName Test.Domain.Net
ProxyRequests on
SSLEngine On
SSLProxyEngine On
ProxyPreserveHost Off
# Redirect HTTPS traffic
ProxyPass / https://Server.LocalDomain.net/
ProxyPassReverse / https://Server.LocalDomain.net/
SSLCertificateFile /etc/letsencrypt/live/Test.Domain.Net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/Test.Domain.Net/privkey.pem
<Proxy "*">
Order allow,deny
Allow from all
</Proxy>
ErrorLog /var/log/apache2/Proxy/TDN.log
CustomLog /var/log/apache2/Proxy/TDN-access.log combined
</VirtualHost>
This can be placed in a file in /etc/apache2/sites-available (And, of course, linked into /etc/apache2/sites-enabled). It could also be simply added to /etc/apache2/apache2.conf If you want to do it that way...