FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Virtual Host in Apache

 


mike_phi
Hi there I need some step by step info to set up a virtual host

here is my problem

I am using Fedora core 5 as my linux distro

I have apache web server set up and have a few sub directories I use for various web pages
at the momment i need to do the folowing to brows my pages

eg

on disk

/var/www/<site A>index.html

in the browser I have to type the following url

http://localhost/<site A>/index.html

what I would like to do is just type

http://<site A>/index.html

and apache should load my local site even if the <site A> = www.example.com


also need to know if there is any DNS setup that would be necessary for this type of arrangement


cheers
jackill
First define:

Code:
127.0.0.1 www.example.com


in Your DNS configuration file /nameserver/.

Then in Apache config:

Code:
NameVirtualHost 127.0.0.1:80

<VirtualHost *:80>
    DocumentRoot "/var/www/site_a"
    ServerName www.example.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin qwe@qwe.pl
    DocumentRoot "/var/www"
    ServerName localhost
</VirtualHost>


For details look here: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.