LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-15-2005, 11:40 AM   #1
dimsh
Member
 
Registered: Aug 2005
Distribution: Debian, Ubuntu, Fedora
Posts: 74

Rep: Reputation: 15
Apache 2.0.54 DocRoot strange behaviour with VirtualHost


Hi

OS: FC4
Apache v2.0.54
Server IP: 1.2.3.4
Server FQDN: main.mydomain.com

vDomain1: space.com
vDomain1: space.info

Symptom: i can not access web file reside in main Server's DocumentRoot (/var/www/html) after I made VirtualHost configuration. Instead I found my self in the DocumentRoot of one of the Virtual Hosts I definded (/var/www/space.com/html). This may because of my Confinuration.

In "httpd.conf" I have:
Quote:
ServerName main.mydomain.com:80
DocumentRoot "/var/www/html"
Include "conf.d/auth_mysql.conf"
Include "conf.d/manual.conf"
Include "conf.d/php.conf"
Include "conf.d/welcome.conf"
Include "conf.d/space.com.conf" // I made it
Include "conf.d/space.info.conf" // I made it

<Directory "/">
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/html">
Options Includes
Order allow,deny
AllowOverride None
</Directory>

**** The rest are with default values ***
In "conf.d/space.com.conf" i have:
Quote:
NameVirtualHost 1.2.3.4:80
<VirtualHost 1.2.3.4:80>
ServerName www.space.com
ServerAlias space.com
ServerAdmin dimsh@xxxx
DocumentRoot "/var/www/space.com/html"
DirectoryIndex index.php index.html index.htm
<Directory "/var/www/space.com/html/">
Allow from all
AllowOverride All
Order allow,deny
Options None
</Directory>
</VirtualHost>
In "conf.d/space.info.conf" i have:
Quote:
# The following directive has been definded already in
# the previous config file "space.com.conf" if it redifided
# here too you get warn "[warn] NameVirtualHost 209.172.55.171:80
# has no VirtualHosts".
# If the Include to file "space.com.conf" has beed excluded from
# httpd.conf's Include statement
# then you MUST turn this directive on:
#NameVirtualHost 1.2.3.4:80
<VirtualHost 1.2.3.4:80>
ServerName www.space.info
ServerAlias space.info
ServerAdmin dimsh@xxxx
DocumentRoot /var/www/space.info/html
<Directory /var/www/space.info/html/>
Allow from all
AllowOverride All
Order allow,deny
</Directory>
Alias /roundcube /var/www/space.info/RoundCubemail
Alias /webmail /var/www/space.info/squirrelmail
</VirtualHost>
<VirtualHost 1.2.3.4:80>
ServerName mail2.space.info
ServerAdmin dimsh@xxxx
DocumentRoot /var/www/space.info/RoundCubemail
<Directory /var/www/space.info/RoundCubemail/>
Allow from all
AllowOverride All
Order allow,deny
</Directory>
</VirtualHost>
<VirtualHost 1.2.3.4:80>
ServerName mail.space.info
ServerAdmin dimsh@xxxx
DocumentRoot /var/www/space.info/squirrelmail
<Directory /var/www/space.info/squirrelmail/>
Allow from all
AllowOverride All
Order allow,deny
</Directory>
</VirtualHost>
space.com.conf precedes space.info.conf in httpd.conf

I have phpAdsNew in "/var/www/html/phpAdsNew" and I can not reach it.

Every time I request the one of the following URLs:
http://1.2.3.4/
http://main.domain.com/
I got the page that resides in "/var/www/space.com/html" which is the DoumentRoot for the first VHost I have definded.

The request for http://1.2.3.4/phpAdsNew returns Not Found.

Why does this happened, why i am in the htdocs of the first VHost not the second one for example (even I do not want this to happen at all) I want to be in the main DocRoot?
That does not make sence for me. Any Suggestions?


Thanks in advance.

Last edited by dimsh; 12-15-2005 at 11:42 AM.
 
Old 12-19-2005, 07:38 PM   #2
jedediah
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: Slackware 10
Posts: 21

Rep: Reputation: 15
Instead of NameVirtualHost 1.2.3.4:80, try NameVirtualHost *:80

That should fix your problem.
 
Old 12-24-2005, 03:31 AM   #3
dimsh
Member
 
Registered: Aug 2005
Distribution: Debian, Ubuntu, Fedora
Posts: 74

Original Poster
Rep: Reputation: 15
Thanks for the replay , I have my replay late because I was busy with tomcat issues, I am thinking really in moving to Tomcat instead.

"NameVirtualHost *:80" , This does not work, instead, I have made a virtual host for the main server, that is like this :
<VirtualHost 1.2.3.4:80>
ServerName main.mydomain.com
ServerAdmin dimsh@xxx
DocumentRoot "/var/www/html"
DirectoryIndex index.php index.html index.htm
<Directory "/var/www/html/">
Allow from all
AllowOverride All
Order allow,deny
Options None
</Directory>
</VirtualHost>

so my main httpd doc root becomes a virtual host inbetween the others and it MUST be definded as the first VirtualHost or it will not serve the main index page as supposed to.

I begin to feel that apache does not serve me well, and it is not documented well.

Last edited by dimsh; 12-24-2005 at 03:36 AM.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache -VirtualHost davidhk Debian 7 08-19-2005 12:33 PM
Fresh Load FC3 Apache err - Docroot must be directory trekk Linux - Networking 18 11-30-2004 04:48 PM
Help with Apache <VirtualHost> please. smakkythecamel Linux - Networking 2 06-12-2003 07:15 PM
apache virtualhost jonfa Linux - Networking 5 08-12-2002 06:07 PM
Strange Behaviour mikeyt_3333 Linux - General 4 08-06-2001 03:07 PM


All times are GMT -5. The time now is 03:27 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