Wednesday, June 17, 2009

Apache + mod_proxy + mod_ssl - A good, secure reverse proxy

File cấu hình vhost

VirtualHost *:80
ServerName website.thehumanjourney.net

# Rewrite all incoming http request from external IP to https
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^10.0.*$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

ProxyPass / http://INTERNALIP/
ProxyPassReverse / http://website.thehumanjourney.net/
ProxyPassReverse / http://INTERNALIP/

CustomLog /var/log/apache2/website.thehumanjourney.net.access.log combined
ErrorLog /var/log/apache2/website.thehumanjourney.net.error.log
/VirtualHost
VirtualHost *:443
ServerName website.thehumanjourney.net

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/thehumanjourney.crt
SSLCertificateKeyFile /etc/apache2/ssl/thehumanjourney.key

ProxyPass / http://INTERNALIP/
ProxyPassReverse / http://website.thehumanjourney.net/
ProxyPassReverse / http://INTERNALIP/

CustomLog /var/log/apache2/website.thehumanjourney.net.access.log combined
ErrorLog /var/log/apache2/website.thehumanjourney.net.error.log
/VirtualHost

No comments:

Post a Comment