LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache2 Name-based Virtual Hosts Problem with .org domain! (https://www.linuxquestions.org/questions/linux-software-2/apache2-name-based-virtual-hosts-problem-with-org-domain-475484/)

phoenix09 08-19-2006 07:06 PM

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>


isuck@linux 08-19-2006 08:11 PM

what does the log say for that virtualhost?

w3bd3vil 08-19-2006 08:27 PM

could it be that the dns of the site3.org isnt pointing to your server yet?

isuck@linux 08-19-2006 08:48 PM

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?

phoenix09 08-19-2006 08:48 PM

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?

phoenix09 08-19-2006 08:51 PM

yes the dig is resolving site3.org to my correct ip and nameservers as I set them.

isuck@linux 08-19-2006 08:51 PM

who has the SOA? you need an SOA record I dont see it there.

phoenix09 08-19-2006 08:57 PM

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?

phoenix09 08-19-2006 08:59 PM

an SOA record? the everydns options only list a possible choice of A, CNAME, NS or MX

should i switch dns hosts?

isuck@linux 08-19-2006 09:07 PM

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.

w3bd3vil 08-19-2006 09:17 PM

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

phoenix09 08-19-2006 09:37 PM

thats interesting but as you can see from my httpd.conf file the servername and alias are correct.

w3bd3vil 08-19-2006 09:53 PM

lol :)
i see site3.org not the true name.

phoenix09 08-19-2006 10:04 PM

lol forget about that thats just for a lil privacy

phoenix09 08-20-2006 02:18 PM

great. i did something to the httpd.conf file and now ALL my domains revert to the default.


All times are GMT -5. The time now is 02:21 AM.