• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

i want to host more then 1 site on local centos mach.

i want to host more then 1 site on virtual. on my system with operating system centos 5. apache was installed with the installation of the centos. so all the files are on default location.
 how can i host test1.abc.com and test2.abc.com on a same vps so that i can test this site.
0
serveradmin
Asked:
serveradmin
  • 3
  • 2
1 Solution
 
joolsCommented:
you can edit the httpd.conf file  and create virtual host entries;

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /var/www/html
    ServerName www.mydomain.com
    ErrorLog logs/mydomain-error_log
    CustomLog logs/mydomain-access_log common
</VirtualHost>
 
<VirtualHost *:80>
    ServerAdmin webmaster@otherdomain.com
    DocumentRoot /var/www/html/othersite
    ServerName www.otherdomain.com
    ErrorLog logs/otherdomain-error_log
    CustomLog logs/otherdomain-access_log common
</VirtualHost>

Open in new window

0
 
serveradminAuthor Commented:
i am getting error when i restart the httpd after doing the configuration u told

starting httpd: [Fri May 01 09:54:54 2009] [Warn] _default_ VirtualHost overlap on port 80, the first as precedence
[Fri May 01 09:54:54 2009] [Warn] _default_ VirtualHost overlap on port 80, the first as precedence

but all the domains are openng to the default apache page rather then the index page i placed in the folder location.
0
 
joolsCommented:
they are warnings but it is a bit annoying...
can you post you complete config here?
0
 
serveradminAuthor Commented:
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

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

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

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

rest is default as it was
0
 
joolsCommented:
OK, forgot some things :-)

Set your main server name.
   ServerName www.mydomain.com:80

Make sure NameVirtualHost is set;
   NameVirtualHost *:80

Then try and restart apache.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now