Transparent proxy for only one virtual host.

Discussion in 'Apache' started by Pierre Monteux, Jun 13, 2009.

  1. #1
    Here's my current setup. I have a windows webserver, hosting a website on one domain name. I'm setting up a linux webserver to host more websites. Now since both of these servers are behind a nat, I'm running into the issue where I could have either server live, but not both, unless I deviate from port 80.

    Both servers are running apache2.

    I've been reading a bit of sites and it seems it is possible to have mod rewrite cause apache to act as a transparent proxy. I've tried this below, but it didn't work.

    What I'm attempting here is have the new server only handle the new website, and forward everything else as is to the old server. Currently what I get is just a directory listing when I try this on the redirect.

    Thanks in advance.

    virtual hosts snippet from httpd.conf
    <VirtualHost newsite.com:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/monteux
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/monteux>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
    
    </VirtualHost>
    
    
    Code (markup):
    .htaccess in www/monteux
            RewriteEngine On
            RewriteRule ^/(.*) http://192.168.1.5/$1 [P]
    
    Code (markup):

     
    Pierre Monteux, Jun 13, 2009 IP
  2. vasyl

    vasyl Peon

    Messages:
    138
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why don't you put everithing on one server - since both are apache?
     
    vasyl, Jun 14, 2009 IP
  3. Pierre Monteux

    Pierre Monteux Peon

    Messages:
    63
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'd like to eventually, but thats not really an option at the moment. The existing website was programmed without case sensitivity in the paths, so almost every page broke when I tried moving it to linux. If it isn't possible to get apache to work as a transparent proxy, I guess redoing the website would be my only option. I just don't have enough time to go through all of that now.
     
    Pierre Monteux, Jun 14, 2009 IP
  4. vasyl

    vasyl Peon

    Messages:
    138
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0