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

Is apache a application server?

0 Answers  


In software testing Business requirements or FRD is given,u will have start preparing test cases. In the document only text box is mentioned for a particular option.So do u prepare test cases including special characters,numbers,alphabets,alphanumeric or only for some. Pls help me out.

0 Answers  


What is apache web server?

0 Answers  


Is apache single threaded?

0 Answers  


How would you describe the apache web server in brief?

0 Answers  






How can we find what are the modules loaded in apache?

0 Answers  


What we can do to find out how people are reaching your site?

0 Answers  


What is httpd service?

0 Answers  


What are the features of apache web server?

0 Answers  


What is a difference between apache and nginx web server?

0 Answers  


If you specify both deny from all and allow from all, what will be the default action of Apache?

4 Answers  


In which language apache is written?

0 Answers  


Categories