LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-23-2010, 12:23 AM   #1
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
ome misconfiguration in making a reverse proxy not clear what went wrong


I want to host sites.
http://www.myserver.com
http://site1.myserver.com
I have a public IP rest is on LAN.The main site is on public IP and want any request on site1.myserver.com to be redirected to internal LAN web server which will process the requests.
I am using a Debian Lenny and apache2.

In an earlier post on the forum I was able to configure Apache Reverse Proxy
by changing apache2.conf
the sites hosted at that time were
http://www.myserver.com
http://www.myserver.com/site1

Now I have formatted my server and it is a fresh installation of Debian Lenny and apache2 on it so previous settings are not there.
This time I created two virtual hosts.There are two files in /etc/apache2/apache2.conf
site1.myserver.com
and myserver.com
then
a2ensite myserver.com
a2ensite site1.myserver.com

The configuration of these are as follows
/etc/apache2/sites-available/myserver.com
contains
Code:
NameVirtualHost 10.10.10.10:80
NameVirtualHost 192.168.1.14:80
<VirtualHost 192.168.1.14:80 10.10.10.10:80>
#10.10.10.10 is  my public IP
#The above idea was from apache documentation http://httpd.apache.org/docs/2.0/vhosts/examples.html
        ServerAdmin webmaster@localhost
        ServerName myserver.com
        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>
and the file
/etc/apache2/sites-available/site1.myserver.com
has


Code:
NameVirtualHost 10.10.10.10:80
NameVirtualHost 192.168.1.14:80
<VirtualHost 192.168.1.14:80 10.10.10.10:80>
#10.10.10.10 is  my public IP
#The above idea was from apache documentation http://httpd.apache.org/docs/2.0/vhosts/examples.html
        ServerAdmin webmaster@localhost
        ServerName site1.myserver.com
        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
         ProxyRequests off
        <Proxy *>
        Order deny,allow
        Allow from all
        </Proxy>
        ProxyPass / http://192.168.1.6/
        ProxyPassReverse / http://192.168.1.16/
       
 
        <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>
Then /etc/init.d/apache2 restart .Now If I point my browser to
http://www.myserver.com
or http://site1.myserver.com
they both are pointing to same site http://www.myserver.com

I do not have access to DNS.
In my /etc/hosts
I have
Code:
127.0.0.1       localhost
192.168.1.14  myserver.com myserver
192.168.1.6   site1.myserver.com site1
I wasted 24 hours on this went through
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
http://httpd.apache.org/docs/2.0/dns-caveats.html
http://httpd.apache.org/docs/2.0/vhosts/
but still I am not able to catch the problem.
There is no URL rewriting till now.Can some one point what should I do or check?

Last edited by tkmsr; 04-23-2010 at 12:24 AM.
 
Old 04-23-2010, 02:13 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
This is because both vhosts are using the sane DocumentRoot
Quote:
ServerName myserver.com
DocumentRoot /var/www/

--SNIP--

ServerName site1.myserver.com
DocumentRoot /var/www/
 
Old 04-23-2010, 02:30 AM   #3
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
Quote:
Originally Posted by bathory View Post
This is because both vhosts are using the sane DocumentRoot
Thanks. I was not clear on this part.It is working now.

Last edited by tkmsr; 04-23-2010 at 02:32 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
making a reverse proxy ambotlang Linux - Server 9 06-23-2008 11:33 AM
Squid as Reverse Proxy and LAN proxy? zivota Linux - Security 2 02-26-2007 05:00 PM
How to clear wrong ext2/3 filesystem descriptor ? zeitounator Linux - General 5 06-25-2006 04:29 PM
DNS misconfiguration or what is wrong here? rebayona Linux - Networking 10 09-27-2005 04:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration