How do you set up a virtual host in Apache?

Answers were Sorted based on User's Feedback



How do you set up a virtual host in Apache? ..

Answer / abhay

<VirtualHost www.test.com>
ServerAdmin admin@test.com
DocumentRoot /home/apache/share/htdocs/hostedsites
ServerName www.test.com
ErrorLog /home/apache/logs/error/hostedsites/error_log
TransferLog /home/apache/logs/access/hostedsites/access_log
</VirtualHost>

Is This Answer Correct ?    9 Yes 1 No

How do you set up a virtual host in Apache? ..

Answer / krishna

apache provide two type of virtual hosting 1- ip based and
2- name based.
to configure name based your dns should work properly.
go to the /etc/httpd/conf/httpd.conf file and remove # from
the start of of Namevertualhost *:80
and than at the end of file write the content below

<VirtualHost "IP of your apache server":80>
ServerAdmin root@krishna.com
DocumentRoot /var/www/krishna/krishna.html
DirectoryIndex krishna.html
ServerName www.krishna.com
ErrorLog /home/apache/logs/error/hostedsites/error_log
TransferLog /home/apache/logs/access/hostedsites/access_log
</VirtualHost>
restart your httpd service by running the command
Service httpd restart or /etc/init.d/httpd restart

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Apache Interview Questions

How to run php/ruby with apache?

1 Answers  


What is an apache logs?

1 Answers  


Can you record all the cookies sent to your server by clients in web server logs?

1 Answers  


What is apache tomcat server used for?

1 Answers  


Do I need programming skills to install apache in my system?

1 Answers  


How to configure your very first production web sever?

1 Answers  


What are apache modules?

1 Answers  


Where is the apache config file?

1 Answers  


What is virtual host?

1 Answers  


How to stop/start apache web server?

1 Answers  


Is the apache license free?

1 Answers  


Is apache an open source?

1 Answers  


Categories