LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-19-2006, 07:06 PM   #1
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Rep: Reputation: 0
Apache2 Name-based Virtual Hosts Problem with .org domain!


Im having trouble getting my 3rd website to work on my apache2 server;
the others work ok, this is a .org domain im trying to get working but when i enter the site into my browser it goes to my default site instead.
Please help!

Code:
#NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/site1
        ServerName www.site1.com
        ServerAlias site1.com

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site1>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        </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
        ServerSignature On

    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 *>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/site2
        ServerName www.site2.com
        ServerAlias site2.com


<Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site2>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        </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
        ServerSignature On

    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 *>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/site3
        ServerName www.site3.org
        ServerAlias site3.org


<Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site3>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/

        </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
        ServerSignature On

    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>
 
Old 08-19-2006, 08:11 PM   #2
isuck@linux
Member
 
Registered: Jun 2006
Distribution: messed up debian
Posts: 250

Rep: Reputation: 30
what does the log say for that virtualhost?
 
Old 08-19-2006, 08:27 PM   #3
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191

Rep: Reputation: 49
could it be that the dns of the site3.org isnt pointing to your server yet?
 
Old 08-19-2006, 08:48 PM   #4
isuck@linux
Member
 
Registered: Jun 2006
Distribution: messed up debian
Posts: 250

Rep: Reputation: 30
I dont think is dns related if he is getting to the correct ip, does the output of
dig www.site3.org
shows your ip?
 
Old 08-19-2006, 08:48 PM   #5
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
i use everydns.com and ive set records as follows:

site3.org HOST

A TYPE

6x.1xx.2x.1xx VALUE


www.site3.org HOST

A TYPE

6x.1xx.2x.1xx VALUE

are those ok? because the ip is of the server im using to host the other 2 and they work


-- oh and what log are you talking about?
 
Old 08-19-2006, 08:51 PM   #6
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
yes the dig is resolving site3.org to my correct ip and nameservers as I set them.
 
Old 08-19-2006, 08:51 PM   #7
isuck@linux
Member
 
Registered: Jun 2006
Distribution: messed up debian
Posts: 250

Rep: Reputation: 30
who has the SOA? you need an SOA record I dont see it there.
 
Old 08-19-2006, 08:57 PM   #8
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
Code:
[Sat Aug 19 18:55:00 2006] [error] [client 6x.2xx.2x.3x] File does not exist: /var/www/site1/var, referer: http://www.site3.org/css3.css
thats from the apache2 error log -- its showing a file does not exist but the strange thing is this is coming from site3.org/css3 ( css3.css is a file in the site1 folder !)
can someone please tell me what i need to clarify?
 
Old 08-19-2006, 08:59 PM   #9
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
an SOA record? the everydns options only list a possible choice of A, CNAME, NS or MX

should i switch dns hosts?
 
Old 08-19-2006, 09:07 PM   #10
isuck@linux
Member
 
Registered: Jun 2006
Distribution: messed up debian
Posts: 250

Rep: Reputation: 30
Do you query and internal dns? I mean if you use you own dns resolver or you query an external one. I really dont see anything wrong with your conf file.
If you query and internal dns check the zones for your internal network and clean the cache.
 
Old 08-19-2006, 09:17 PM   #11
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191

Rep: Reputation: 49
Quote:
Looking in Apache's access log (/var/log/httpd/access_log) we can see what was received:

127.0.0.1 - - [01/May/2003:21:16:04 -0500]
"GET /cgi-bin/search.cgi HTTP/1.1" 200 843 "http://local-client_a.com/"
"Mozilla/4.0(compatible;MSIE 5.0;Linux 2.4.20-2.48 i686)Opera 6.11[en]"

Apache then looks up 127.0.0.1 in its vhost address sets table and finds three vhosts associated with the address. It then scans for a ServerName in order of entry that matches local-client_a.com. If it fails to find a match, it will go back to the first entry for 127.0.0.1 (localhost) and use it.
this is what I found. same thing seems to happen on your host. when you type in www.site3.org it goes to www.site1.com, try making sure the ServerName is correct
 
Old 08-19-2006, 09:37 PM   #12
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
thats interesting but as you can see from my httpd.conf file the servername and alias are correct.
 
Old 08-19-2006, 09:53 PM   #13
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191

Rep: Reputation: 49
lol
i see site3.org not the true name.
 
Old 08-19-2006, 10:04 PM   #14
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
lol forget about that thats just for a lil privacy
 
Old 08-20-2006, 02:18 PM   #15
phoenix09
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
great. i did something to the httpd.conf file and now ALL my domains revert to the default.
 
  


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
Apache2 - need help with virtual hosts bioalchemist Linux - Software 5 08-11-2006 01:24 PM
Subdomains on Apache2 with virtual hosts - how? <Ol>Origy Linux - Networking 2 08-18-2005 05:53 AM
Apache2, SSL, 2 Virtual Hosts franticbob Linux - Software 0 04-07-2004 09:48 PM
IP based virtual hosts problem adm1329 Linux - Networking 4 03-11-2004 10:40 AM
apache2 virtual hosts viniosity Linux - Software 4 02-07-2004 12:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:52 AM.

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