Last active
December 20, 2015 23:39
-
-
Save alkalinecoffee/6214090 to your computer and use it in GitHub Desktop.
Apache vhost config for Unicorn with whitelisted IPs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName localhost | |
# ServerAlias www.localhost.com | |
DocumentRoot /var/www/myrailsapp/current/public | |
RewriteEngine On | |
# Redirect all non-static requests to unicorn | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L] | |
<Proxy balancer://unicornservers> | |
BalancerMember http://127.0.0.1:8080 | |
# by default, deny everything | |
order deny,allow | |
deny from all | |
# add whitelisted ips and ranges | |
allow from 127.0.0.1 | |
allow from 192.0.0.0/8 | |
allow from 192.168.1 | |
allow from 192.168.1.100 | |
</Proxy> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment