Skip to content

Instantly share code, notes, and snippets.

@zviri
Created November 30, 2013 19:05
Show Gist options
  • Save zviri/7723152 to your computer and use it in GitHub Desktop.
Save zviri/7723152 to your computer and use it in GitHub Desktop.
Apache safe config with mod_proxy
# simple http authentification with htpasswd
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
AuthName "Restricted"
AuthGroupFile /dev/null
AuthType Basic
AuthBasicProvider file
AuthUserFile /etc/users/.htpasswd
Require user $USER_NAME
</Directory>
# deny usage of proxy, should be already by default in most apache2 installations
<Proxy *>
Order deny,allow
Deny from all
</Proxy>
ProxyPass /jenkins http://localhost:8081/jenkins
ProxyPassReverse /jenkins http://localhost:8081/jenkins
# IMPORTANT: proxy cannot be used as open proxy
ProxyRequests Off
# controlling access to specific proxy redirection
<Proxy http://localhost:8081/*>
Order deny,allow
Allow from all
AuthType Basic
AuthName "Password Required"
AuthUserFile /etc/users/.htpasswd
Require user $USER_NAME
</Proxy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment