Linux-Noob Forums
Apache - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Server Administration (https://www.linux-noob.com/forums/forum-8.html)
+--- Forum: LAMP (https://www.linux-noob.com/forums/forum-83.html)
+--- Thread: Apache (/thread-3497.html)



Apache - kernel2 - 2004-04-04


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




Apache - Guest - 2004-07-09


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..




Apache - z0ny - 2004-07-09


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