How do you set up a virtual host in Apache?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check the version of apache server?

482


How does Apache compared to other servers?

1590


I use IIS 6 and Apache 2.0.52 and I want to need connector IIS with tomcat. My tomcat using 8080 IIS using 80 my Apache application name is workspace and how can I use http://myserverip/workspace ? with isapi or anaother connector Best regards.

1665


Is apache a application server?

468


How do I download apache web server?

490






What is apache timeout?

496


On which port apache server works?

478


What are the log level available in apache?

540


Who bought apache?

475


How to disable trace http request?

495


What is systemctl start?

498


What is offical website of apache?

532


What’s difference between apache web server and apache tomcat?

443


What is a Command to restart/start apache web server?

478


What is apache http server used for?

448