Skip to content

Instantly share code, notes, and snippets.

@lovellfelix
Last active June 2, 2020 18:01
Show Gist options
  • Save lovellfelix/6676386 to your computer and use it in GitHub Desktop.
Save lovellfelix/6676386 to your computer and use it in GitHub Desktop.
Using Apache as a proxy server.
<VirtualHost *:80>
Servername lb-test.example.com
Redirect / https://lb-test.example.com/
</VirtualHost>
<VirtualHost *:443>
Servername lb-test.example.com:443
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/example.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/example.com.key
SSLCertificateChainFile /etc/pki/tls/certs/example.com-chain.crt
ProxyPreserveHost On
ProxyRequests Off
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://tomcatcluster>
BalancerMember http://10.0.18.106:8080 route=1
BalancerMember http://10.0.18.107:8080 route=2
ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass / balancer://tomcatcluster/
ProxyPassReverse / balancer://tomcatcluster/
SSLProtocol -All -SSLv2 -SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4"
</VirtualHost>
#Displays port 8080 on 80
<VirtualHost *:80>
Servername example.com:80
ProxyPreserveHost On
ProxyPass / http://192.168.171.65:8080/
ProxyPassReverse / http://192.168.171.65:8080/
</VirtualHost>
#Displays port 8080 on 443
<VirtualHost *:80>
Servername example.com
Redirect / https://example.com/
</VirtualHost>
<VirtualHost *:443>
Servername example.com:443
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/yourcert.crt
SSLCertificateKeyFile /etc/pki/tls/private/yourcert.key
SSLCertificateChainFile /etc/pki/tls/certs/yourcert-chain.crt
ProxyPreserveHost On
ProxyPass / http://10.0.18.88:8080/ connectiontimeout=1200 timeout=1200
ProxyPassReverse / http://10.0.18.88:8080/
SSLProtocol -All -SSLv2 -SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4"
</VirtualHost>
<VirtualHost *:80>
Servername v8.example.com
Redirect / https://v8.example.com/
</VirtualHost>
<VirtualHost *:443>
Servername v8.example.com:443
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/example.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/example.com.key
SSLCertificateChainFile /etc/pki/tls/certs/example.com-chain.crt
ProxyPreserveHost On
ProxyPass / http://10.0.18.116:7001/ connectiontimeout=1200 timeout=1200
ProxyPassReverse / http://10.0.18.116:7001/
<Location />
Order Deny,Allow
Deny from all
Allow from 10.0.40.20
Allow from 111.94.8.150
</Location>
SSLProtocol -All -SSLv2 -SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment