Forum Moderators: phranque

Message Too Old, No Replies

2 Domain names, one IP

         

alienc

1:08 pm on Feb 10, 2006 (gmt 0)

10+ Year Member



I need to setup 2 seperate domain names in Apache. The issue I have is that the second one works fine with any files from the main folder but any sub-folders (images, documents, etc), do not work. Can you possible see what I need to change in my Virtual host configuration below:

NameVirtualHost 111.111.111.111:80

<VirtualHost 111.111.111.111:80>
ServerName subdomain.siteone.com
DocumentRoot /var/fserve/www_data/
AddType application/x-httpd-php .html
DirectoryIndex index.html
</VirtualHost>

<VirtualHost 111.111.111.111:80>
ServerName subdomain2.siteone.com
DocumentRoot /var/fserve/www_data/content/
AddType application/x-httpd-php .html
DirectoryIndex index.html
</VirtualHost>

<VirtualHost 111.111.111.111:80>
ServerName www.sitetwo.com
DocumentRoot /var/fserve/www_data/contenttwo/
DirectoryIndex index.php
</VirtualHost>

The first 2 sites work properly and have no issues, but the site on the second domain name is the one that does not work properly.

Any ideas on how to get this to work properly? Right now, I have a Redirectpermanent setup for the last site that works but the user sees the ip address of the server in the address bar not the domain name.

jdMorgan

3:24 pm on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since you're using one IP address, you need to use name-based virtual hosting. You'll need to add a global ServerName and DocumentRoot directive. See these documents: [httpd.apache.org...]

(I linked to Apache 1.3, since you didn't include your server version.)

Jim

alienc

3:29 pm on Feb 10, 2006 (gmt 0)

10+ Year Member



Yes, I am using 1.3. I will take a look at the link. I did some research on it but couldn't figure out what I needed to use.

alienc

6:13 pm on Feb 10, 2006 (gmt 0)

10+ Year Member



Here is the resolution to this one, definitely not what I expected.

All sub-folders worked save for the images one after checking.

The issue was that in the httpd.conf script there was a section in there attached below:

<IfModule mod_alias.c>
Alias /icons/ /usr/share/apache/icons/

<Directory /usr/share/apache/icons>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /images/ /usr/share/images/

<Directory /usr/share/images>
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</IfModule

Now when I commented out the Alias /images... line and restarted all was well.

This was purely on a guess that maybe someone went in there and put an alias on the images folder and there is was.

So thanks for the info anyways, I found this site looking for a resolution to this problem and I will be sure to drop by if I come into any other issues.