Solved

landing on the same page for diffrent domains in apache virtualhosts

Posted on 2009-05-03
3
360 Views
Last Modified: 2013-11-08
i have following configuration in my httpd server installed on centos mach locally. for testing reasons

in my /etc/hosts file i place following code
101.168.1.25  www.solutionsbeyond.local
101.168.1.25  forum.solutionsbeyond.local
101.168.1.25  forum2.solutionsbeyond.local

and in /etc/httpd/conf/httpd.conf

NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin  admin@solutionsbeyond.local
DocumentRoot  /home/httpd/sb
ServerName www.solutionsbeyond.local
DirectoryIndex index.php index.html index.htm
</VirtualHost>

<VirtualHost *:80>
ServerAdmin  admin@solutionsbeyond.local
DocumentRoot  /home/httpd/test
ServerName forum.solutionsbeyond.local
</VirtualHost>

<VirtualHost *:80>
ServerAdmin  admin@solutionsbeyond.local
DocumentRoot  /home/httpd/phpbb
ServerName forum2.solutionsbeyond.local
DirectoryIndex index.php index.html index.htm
</VirtualHost>

no i have i file index.html on each folder  with sub domain typed in it. Now the problem i am facing is that when i type www.solutionsbeyond.local i see index page displaying Welcome to www.solutionsbeyond.local.

now when i try to go to forum.solutionsbeyond.local i still get to page where it displays "welcome to www.solutionsbeyond.local but i type forum.solutiuonsbeyond.local i get the msg welcome to forum.solutionsbeyond.local what can be the resone behind it and how can i fix it more over i want apache to pick the index.php by default and for that i places

DirectoryIndex index.php index.html index.htm in the virtual directory code but i its not working how can i make it working
0
Comment
Question by:serveradmin
3 Comments
 
LVL 2

Accepted Solution

by:
keithdmitchell earned 500 total points
ID: 24296586
Since this is local, we can't see anything you've done. However are you using a windows machine? If so can you edit it's host file (c:\windows\system32\drivers\etc\hosts) and add the following entries;

101.168.1.25  www.solutionsbeyond.local
101.168.1.25  forum.solutionsbeyond.local
101.168.1.25  forum2.solutionsbeyond.local

Apache will pick whatever index page is setup in the default document listing, unless there isn't one specified or the containers are not setup correctly, in which you'll get the default global index page.

By adding the entries to your pc's hosts file, you'll be able to go directly to the sites to see if the issues is just with resolving to the sites or if apache isn't configured correctly.

Keith D Mitchell, Server Engineer, Hostmysite.com
0
 
LVL 1

Expert Comment

by:esalvador
ID: 24296995
Did you restart apache after doing the changes? (service httpd restart)
Did you change your DNS records to point to that IP address, or did you do it in your local computer hosts file?
I noticed that in:
<VirtualHost *:80>
ServerAdmin  admin@solutionsbeyond.local
DocumentRoot  /home/httpd/test
ServerName forum.solutionsbeyond.local
</VirtualHost>

There is no:
DirectoryIndex index.php index.html index.htm

entry
0
 

Author Comment

by:serveradmin
ID: 24362764
esalvador i change the entry in the local computer hosts file.

101.168.1.25 forum.solutionsbeyond.local
101.168.1.25 forum2.solutionsbeyond.local
101.168.1.25 www.solutionsbeyond.local
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
Teach the user how to rename, unmount, delete and upgrade VMFS datastores. Open vSphere Web Client: Rename VMFS and NFS datastores: Upgrade VMFS-3 volume to VMFS-5: Unmount VMFS datastore: Delete a VMFS datastore:
Advanced tutorial on how to run the esxtop command to capture a batch file in csv format in order to export the file and use it for performance analysis. He demonstrates how to download the file using a vSphere web client (or vSphere client) and exp…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question