LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache 2.0.54 DocRoot strange behaviour with VirtualHost (https://www.linuxquestions.org/questions/linux-newbie-8/apache-2-0-54-docroot-strange-behaviour-with-virtualhost-393201/)

dimsh 12-15-2005 11:40 AM

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.

jedediah 12-19-2005 07:38 PM

Instead of NameVirtualHost 1.2.3.4:80, try NameVirtualHost *:80

That should fix your problem.

dimsh 12-24-2005 03:31 AM

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.


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