Hello Apache Fam, This is my first post so forgive me if this is not right place. Basically i am rather new to apache and i am running one of my first php sites which i believe(php) works best with apache. My question is, how exactly do i get apache to host multiple different sites with different ip addresses? I am IIS user and trying to move over to apache. IIS had a easy GUI that i used to configure all different sites.... Thanks For Any Help N Advance,
You can find this in the apache 2.0 docs... You need virtual hosts to host multiple sites with Apache 2 in httpd.conf, e.g. NameVirtualHost 12.34.57.78:80 <VirtualHost 12.34.57.78:80> ServerName yourdomainhere DocumentRoot /www/bob </VirtualHost> <VirtualHost 12.34.57.78:80> ServerName yourdomainhere DocumentRoot /www/jane </VirtualHost> <VirtualHost 12.34.57.78:80> DocumentRoot /www/sam ServerName yourdomainhere </VirtualHost>
i am using VMWae and the one websever i am using is a Virtual machine.....is A Virtual Machine the same as a Virtual Host??? If that is the case, i need to create a new Virtual Machine for each site and how will i point each site to diff ip?? Do i have to install some more ethernet ports?? Thanks For All Help
No a virtual machine is not the same as a virtual host. A virtual machine in vmware is like a real machine except it uses some virtual hardware/ paravirtualization. Are you able to access this web server from the internet, external to your private network? The whole idea behind virtual hosts is that you don't have to have more than one ip for each domain. With virtual hosting you can have any number of sites on one IP address. If you read the apache docs then it will explain how to setup virtual hosting in apache. You should be able to forward ports in your router/firewall to your virtual machines IP address and make your apache server public facing with no problems. You can search google for how to do this or look at sites like portforward.com. So you shouldn't need more nics/ports.
so is virutal hosting just for sharing ip?? My client is wanting to have each site on its own ip address. So you are saying i will be able to host several sites from one webserver via vmware without having to add nic's?? Thanks for all our help
You would need to buy static ips from your isp/datacenter and bind the ips to the virtual machine's interface. You can bind more than one ip to one nic. It sounds like you might need another solution, are you trying to host these sites at home? How many websites/domains are you trying to host? Why does your client need all his sites on different ip addresses?
Yes i am looking to host about 3-5 different sites from my server. Not sure why client wants to host multiple sites on different ip but i know he said that was part of the package he got. He has about 13 different static ip ready for use. He has this thing with sites being able to work better on there own ip then using the same ip addresses. So the ip's have been bought, i am just stuck on how i would be creating these sites and giving them there own ip address when i am only using one nic??? Would i need to create another virtual machine for each site or can i use same vm(webserver) for multiple sites and somehow still give them their own ip address?? Thanks So Much
OK, even with different ips you still need to use the same virtual hosting, you'll need to name a virtual host for each ip address. Also, you're goin to need to assign those ips which he wants to use to your webserver. Is your web server at the same ISP he bought those statics from?
My first site pops up with no issues but second site is giving me access denied error: Forbidden You don't have permission to access / on this server. Just looking to host just 2 sites at the moment but more later down road. My code is: NameVirtualHost 72.240.14.8:80 <VirtualHost 72.240.14.8:80> ServerName www. test1.com DocumentRoot D:/www/test1 </VirtualHost> <VirtualHost 72.240.14.8:80> ServerName www. test2.com DocumentRoot D:/www/test2 </VirtualHost>
everything is working great!! Thanks! I ended up just using the vhost file and putting the sites there