Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with namevirtual servers not working now?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Folks:

I've come to the point where I need to ask someone who knows as I am going crazy with this for the past few days.

I am using Apache 2.2.14 installed under XAMPP for Linux on Ubuntu Server. While my apache config shows no hard errors in the error_log the symptoms I am getting as as follows:

1) when I try certain domain names they are intercepted by the main server defintion(default).

2) when I try to access a particular program on a name virtual server the error log shows that the specified program cannot be found (because its looking in the main directory).

I've coded a few sections of my main and virtual server definitions below and while their contents seem to match the reference materials I'm using, I cannot seem to get around the issues explained above.

Hopefully some of you intimately familiar with the configuration of Apache in this environment can enlighten me as to what or how I might be doing something incorrectly and suggest the correct way to do this?

I will be greatly indebted to you all.

Thanks - B [bigears]


# Define Local/Default Web Service Directives

Listen 80
NameVirtualHost *:80
ServerRoot /opt/lampp
ServerAdmin admin@xyz.com
ServerName 0.xyz.com
DocumentRoot /opt/lampp/htdocs
ErrorLog logs/error_log
LogLevel warn
EnableMMAP off
EnableSendfile off
HostNameLookups off
Alias /inc/ /opt/lampp/htdocs/inc/

# First virtual host
<VirtualHost *>
<IfDefine SSL>
SSLEngine off
</IfDefine>
DocumentRoot /opt/lampp/htdocs/dir1
ServerName ServerAlias ServerAdmin admin@abc.net
ErrorLog /opt/lampp/logs/dir1/error.log
CustomLog /opt/lampp/logs/dir1/access.log common
<Directory /opt/lampp/htdocs/dir1>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /inc/ /opt/lampp/htdocs/inc/
</VirtualHost>

# Second Virtual Host
<VirtualHost *>
<IfDefine SSL>
SSLEngine off
</IfDefine>
DocumentRoot /opt/lampp/htdocs/dir2
ServerName ServerAlias ServerAdmin admin@def.com
ErrorLog /opt/lampp/logs/dir2/error.log
CustomLog /opt/lampp/logs/dir2/access.log common
<Directory /opt/lampp/htdocs/dir2>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /inc/ /opt/lampp/htdocs/inc/
</VirtualHost>
 
When you define at least one virtualhost, the default becomes the first one defined and the "main" server is ignored. Whenever apache can't find a virtualhost, it uses the default. Since it is not defaulting to your first virtualhost we can assume that apache doesn't see your vhosts at all. I don't know anythng about your configuation, but look in httpd.conf for the "Include" directive. It should reference the file that has your vhost definitions. This file gets read every time apache starts so you will have to restart apache if you make any changes to httpd.conf or any Include files. Be advised that httpd.conf could be called somethng else on your system. In any case, I'm refering to apache's main configuration file.
 
Thank you for the reply and I did do what you suggested. By trial and error I was able to determine that the culprit was the "options FollowSymLinks" directive. Other than the sites-enabled directory, I don't recall having any symlinks. But as soon as I placed those in EACH virtual section, they started to work as expected. And this declarative seems to NOT be inherited. Go figure.

Thanks again - B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top