Skip to content

Instantly share code, notes, and snippets.

@t-chab
Created November 18, 2014 16:24
Show Gist options
  • Save t-chab/7cfa4eccf2dcd5132021 to your computer and use it in GitHub Desktop.
Save t-chab/7cfa4eccf2dcd5132021 to your computer and use it in GitHub Desktop.
Apache reverse proxy sample configuration
ServerRoot "/opt/httpd-proxy"
LoadModule alias_module modules/mod_alias.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LogLevel debug
ErrorLog "logs/error_httpd.log"
CustomLog "logs/access_httpd.log" "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
SSLSessionCache none
Listen 127.0.0.1:8000
<VirtualHost _default_:*>
DocumentRoot "htdocs"
<Directory />
Order Deny,allow
Deny from all
AllowOverride none
</Directory>
</VirtualHost>
NameVirtualHost 127.0.0.1:8000
<VirtualHost 127.0.0.1:8000>
ServerName localproxy-http.lan
HostnameLookups Off
# SSL Config
SSLProxyEngine On
SSLProxyCheckPeerCN On
SSLProxyCheckPeerExpire On
#############################################################
## Reverse proxy
#############################################################
ProxyVia Block
ProxyPass / http://localhost:8888/
ProxyPassReverse / http://localhost:8888/
RewriteEngine On
RewriteLog "logs/mod_rewrite.log"
RewriteLogLevel 3
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [P]
#############################################################
## Forward Proxy
#############################################################
#ProxyRequests On
#<Proxy *>
# Order deny,allow
# Allow from localhost
#</Proxy>
#ProxyRemote * http://localhost:8888
RequestHeader set Proxy-Authorization "Basic XXXXXXXXXXXXXX"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment