Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Apache
#1

Hi

 

I have a question and can you please give me a example of how I can added a secibd vhosting under apache? The server domain name is cyberchatnet..com and the directory is located in the /home/www directory.

 

I am tyying tgo add a second domain as ecoads.net and I want everything to point to the /home/ecoads directory. I also need it to be www.ecoads.net and ecoads.net. I gave up oin trrying to do it with web admin, so I am doing this manualy.

 

I also need to define a different log file for each virtual host.

 

 

<VirtualHost 65.110.39.130>

DocumentRoot /home/www

ServerName cyberchatnet.com

</VirtualHost>

 

 

Thank you

Reply
#2

Ok, first you name the vhost, in you apache config file (usually httpd.conf):

 



Code:
NameVirtualHost 10.0.0.2:80


where 10.0.0.2 is your ip (if your behind a router set this to your internal/dummy ip). now we set the vhosts

 



Code:
<VirtualHost 10.0.0.2:80> ServerName cyberchatnet.com DocumentRoot /home/www LogLevel  warn ErrorLog /the/dir/you/want/your/error/log.txt CustomLog /the/dir/you/want/your/access/log.txt combined </VirtualHost>




and for the www:



Code:
<VirtualHost 10.0.0.2:80> ServerName www.cyberchatnet.com DocumentRoot /home/www LogLevel  warn ErrorLog /the/dir/you/want/your/error/log.txt CustomLog /the/dir/you/want/your/access/log.txt combined </VirtualHost>


etc..

Reply
#3

If you want the same document root to be available from different (sub)domains the 'ServerAlias' directive should be preferred:

 



Code:
<VirtualHost 10.0.0.2:80>  ServerAdmin admin@cyberchatnet.com  DocumentRoot /var/www/html  ServerName cyberchatnet.com  ServerAlias www.cyberchatnet.com subdomain.cyberchatnet.com  ErrorLog /var/log/error.log  CustomLog /var/log/access.log common </VirtualHost>




 

z0ny

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)