You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jacobo García <ja...@the-cocktail.com> on 2007/06/20 19:02:12 UTC
[users@httpd] Apache + Mod_Rewrite + IP Auth + Mongrels
Hello,
I'm working on a setup with the following structure, all the software is
in the same server.
Apache 2 server with mod_proxy, mod_rewrite and some others.
An apacher conf file with 3 Virtualhosts of different domains for a
rails app.
Each virtual hosts has some rules to redirect petitions to a mongrel
cluster (which is an http webserver oriented for rails app)
I need to implement some auth based on ips, all 3 virtualhosts needs the
same ips for auth.
My problem cames when managing the ip list, there is a lot of editing
when adding new ips, so i am looking for a way to centralize the list of
ips and then use this list in all checks. I've been looking for using
RewriteMap or something like this, but I have a little experience with
apache.
Each virtualhost file is almost identical except for some path names.
Here is the config of one virtual host.
<VirtualHost *:80>
Servername my.example.com
ServerAdmin my@example.com
DocumentRoot /var/www/theapp/current/public/default
<Directory "/var/www/theapp/current/public/default">
Options FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
Allow from x.x.x.x
Allow from x.x.x.x
Allow from x.x.x.x
#.
#.
#.
#Lot of allow rules for some ips
</Directory>
RewriteEngine On
# Rewrite index to check for static
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$
RewriteRule ^([^.]+)$ $1.html [QSA]
# Peticiones de contenido din
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
<Proxy balancer://mongrel_cluster>
BalancerMember http://flamingo:21000
BalancerMember http://flamingo:21001
BalancerMember http://flamingo:21002
BalancerMember http://flamingo:21003
BalancerMember http://flamingo:21004
BalancerMember http://flamingo:21005
</Proxy>
Thanks for your time.
Jacobo García López de Araujo.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org