LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
LinkBack Search this Thread
Old 04-06-2007, 02:29 AM   #1
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Rep: Reputation: 30
NameVirtualHost not working: Akways default to /var/www/html


Hi guys,

I am setting up Apache to work with Tomcat.

Anyway, on apache end, when I configure NameVirtualHost, it doesn't work!

The original settings:

Code:
NameVirtualHost *:80


<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
But no matter what, it always searches for documents at /var/www/html which is define as documentroot earlier in httpd.conf. I even commented that out for it to work.

I had to make it as such before it works:

Code:
NameVirtualHost 192.168.1.10:80


<VirtualHost 192.168.1.10:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
Basically I need to add the IP address before it will work.
While I never had this problem with apache before, it is the first time I am using Centos for this purpose...

and when i restart apache with the new settings it prompted a warning:

Quote:
Starting httpd: [Fri Apr 06 15:30:42 2007] [error] VirtualHost www.domain.com:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
[Fri Apr 06 15:30:42 2007] [error] VirtualHost www.domain1.com:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
any suggestion why is it working this way?

Thanks!

Last edited by Swakoo; 04-06-2007 at 02:35 AM.
 
Old 04-06-2007, 04:16 AM   #2
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
Just to update:

When I leave the settings at default (using *:80), it doesn't work because it still loads from /var/www/html

When I restart the server it shows:

Quote:
Starting httpd: [Fri Apr 06 17:11:45 2007] [warn] VirtualHost www.domain1.com:0 overlaps with VirtualHost www.domain2.com:0, the first has precedence, perhaps you need a NameVirtualHost directive
using multiple vhost

When I remove reference to mod_jk.conf the warning goes, but naturally the tomcat integration doesn't work
 
Old 04-06-2007, 04:57 AM   #3
igorc
Member
 
Registered: May 2005
Location: Sydney, Australia
Distribution: Ubuntu 5.04, Debian 3.1
Posts: 74

Rep: Reputation: 15
<DocumentRoot /www/docs/dummy-host.example.com>

Why do you have a domain name in the DocumentRoot statement. It should be a path to the folder where you have the pages stored.
 
Old 04-07-2007, 04:15 AM   #4
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by igorc
<DocumentRoot /www/docs/dummy-host.example.com>

Why do you have a domain name in the DocumentRoot statement. It should be a path to the folder where you have the pages stored.
that is the path..

basically the path is usually /home/domainname/wwwroot

but i just used the httpd example here. removing it doesn't help
 
Old 04-07-2007, 08:32 PM   #5
igorc
Member
 
Registered: May 2005
Location: Sydney, Australia
Distribution: Ubuntu 5.04, Debian 3.1
Posts: 74

Rep: Reputation: 15
Hi,

This is one of the possible virtual host config:

...
Port 80
ServerName server.domain.tld

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/domain
ServerName www.domain.tld
...
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/subdomain
ServerName www.sub.domain.tld
...
</VirtualHost>

Check the following link: http://httpd.apache.org/docs/1.3/vhosts/examples.html

You will find here some basic settings for name and ip based virtual hosts. I hope this helps.

Cheers,
 
Old 04-08-2007, 09:22 PM   #6
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
yah i have been doing it (VHost) all these while, just that this time I am integrating it with Tomcat... no sure if that's the reason. Anyway, I am re-doing the setup to see if it works... will update here shortly
 
Old 04-09-2007, 04:09 AM   #7
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
have re-setup everything.. got apache and tomcat to work together (via mod_jk) and using virtual host.

End up I figured I had to use the IP address of the server when declaring NameVirtualHost and VirtualHost.

I can't use *.80

So far, so good
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php move_uploaded_file() not working in /var/www/html jon23d Linux - Software 1 06-07-2006 10:25 AM
index.html is not noticed in /var/www/html xviddivxoggmp3 Red Hat 1 04-23-2006 06:30 PM
help in /var/www/html/!! chidomen Linux - Newbie 4 01-13-2005 11:02 AM
ownership of /var/www/html haobaba1 Linux - Security 1 08-04-2003 02:58 PM
chmod of /var/www/html alTereD Linux - Security 1 12-16-2002 02:43 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration