![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Help with Virtual Hosting Multiple Websites - Apache 2.2.2I apologize in advance for the length of this post. I am trying to include as much information as possible to clarify my problem.
I have installed Apache 2.2.2 on Windows XP Pro. Everything works fine if I only want to run one site AND all the files are in the "C:\Program Files\Apache...\htdocs" folder. The problem is when I try to configure Apache to host two sites: www.site1.com and www.site2.com. I know I have to configure Apache for virtual hosting (I want to use Name hosting so that I can host multiple sites on one IP address). The problem is that no matter how I change the configuration files, Apache will only look in "C:\Program Files\Apache...\htdocs" for the index.htm(l) file. It appears as Apache is not seeing my <Virtural Host> </Virtural Host> DocumentRoot definitions. When I try to enter www.site1.com in my browser, I get the website located in the htdocs folder. When I enter www.site2.com in my browser, I still get the website located in the htdocs folder. How do I configure Apache to look in different folders for different sites? Here are the details. The files for the websites are in the following folders: c:\websites\site1 c:\websites\site2 I have changed only one line in the httpd.conf file as follows: # Virtual hosts Include /conf/extra/httpd-vhosts.conf (The only change here is that I removed the '#' in the second line so that the virtual hosts conf file would be included when the service starts.) Here is my httpd-vhosts.conf file (Most of the '#' lines have been deleted for brevity. Note: I have tried copying these files to the httpd.conf file to see if that made a difference. It didn't - same Problem): # # Virtual Hosts # # Use name-based virtual hosting. # NameVirtualHost 127.0.0.1:80 # <VirtualHost 127.0.0.1:80> DocumentRoot /websites/site1 ServerName www.site1.com </VirtualHost> <VirtualHost 127.0.0.1:80> DocumentRoot /websites/site2 ServerName www.site2.com </VirtualHost> |
|
#2
|
|||
|
|||
Re: Help with Virtual Hosting Multiple Websites - Apache 2.2.2Dear Apache user,
Allow me to provide you with a one time support for your little problem ! You need to follow a few standard configuration steps first that works with all Apache versions (v3.x.x - recent version 2.2.3). I have been testen my own configuration on all of above Apache versions and it all works very neately. Wel now, first things first ! Below I give you an example of my own configuration for using just one single IP address for the hosting of multiple internet web sites. But before we get to that, you should check the following steps that you have to take in order to get what you really want. Step #1: You need to have a fixed (= permanent) IP address assigned to you by your ISP. If you don't have one or you're not sure about this then request your ISP for a fixed IP address that is yours and yours alone. Step #2: Register the domain names to your liking by an ISP or any domain name Registrar company. Step #3: -Manage your domain accounts and configure the "A" records to have it pointed to your fixed IP address. -configure the "CNAME" records to your registered domain names. -Eventually configure the "MX" records to your email server (optional). NOW CONFIGURING THE APACHE HTTP SERVER: - In de "HTTPD.CONF" configuration lines, you should enable certain "Include" directives by uncommenting these directives. Uncomment at least the following directives: Listen 80 Include conf/extra/httpd-autoindex.conf Include conf/extra/httpd-vhosts.conf Now you have told Apache to overrule some default configurations ! All you have to do now is configure your de command lines in the "Vhost.conf" file that resides in de "Extra" folder on the Apache Server installation location. Here is an example below of my own config. I have modified some lines because of privacy reasons. However the basic structure remains the same. # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.2/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80 #================================================= ========= #== VIRTUAL CONTAINER 1 <WWW.LANTI-SISTEMA.COM> == #================================================= ========= <VirtualHost www.lanti-sistema.com:80> NameVirtualhost www.lanti-sistema.com ServerName www.lanti-sistema.com ServerAlias *.www.lanti-sistema.eu ServerSignature Email ServerAdmin c.g.landveld@hotmail.com ServerPath "D:/web site1" DocumentRoot "D:/web site1" <Directory /> HostnameLookups On Options Indexes FollowSymLinks MultiViews IndexOptions FancyIndexing DirectoryIndex /index.html # Redirect Permanent /index.html www.lanti-sistema.com/.../.../maintance message.html AllowOverride None Order deny,allow Allow from all Satisfy All </Directory> ErrorLog "D:/folder/folder/[www.lanti-sistema.com] error.log" TransferLog "D:/folder/folder/[www.lanti-sistema.com] access.log" </VirtualHost> #================================================= ========= #== VIRTUAL CONTAINER 2 <WWW.1SRANANTONGO.COM> == #================================================= ========= <VirtualHost www.1sranantongo.com:80> NameVirtualhost www.1sranantongo.com ServerName www.1sranantongo.com # ServerAlias ServerSignature Email ServerAdmin c.g.landveld@hotmail.com ServerPath "D:/web site 2" DocumentRoot "D:/web site 2" <Directory /> HostnameLookups On Options Indexes FollowSymLinks MultiViews IndexOptions FancyIndexing DirectoryIndex /index.html # Redirect Permanent /index.html www.1sranantongo.com/.../.../maintance message.html AllowOverride None Order deny,allow Allow from all Satisfy All </Directory> ErrorLog "D:/folder/folder/[www.1sranantongo.com] error.log" TransferLog "D:/folder/folder/[www.1sranantongo.com] access.log" </VirtualHost> Please notice de difference in above example in comparence to your own configuration ! At last it also is a wise thing to have a DNS server running (already embedded in winxp, win2k and win2k3 and all NT O.S. machines). Cheers ! |
Recent GIDBlog
Meeting the local Iraqis by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bulk Email hosting *** .com Bullet proof hosting | additional2 | Web Hosting Advertisements & Offers | 1 | 20-May-2007 13:55 |
| Lightning fast RESELLER AND SHARED WEB HOSTING! Quality Reseller hosting starting/$10 | Xeserve | Web Hosting Advertisements & Offers | 0 | 24-Jun-2006 11:47 |
| Multiple Domain Hosting – for only $6.95! | luvila | Web Hosting Advertisements & Offers | 0 | 11-Apr-2006 06:55 |
| Types of Web Site Hosting | Olga Elizarova | Web Hosting Forum | 1 | 15-Mar-2006 14:46 |
| Can't view pages from another machine on the Intranet | aevans | Apache Web Server Forum | 9 | 14-May-2004 02:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The