|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
APACHE / Win98 / Virtual Hosts.
As will soon become clear I know nothing about setting up APACHE, so I am looking for help from any resident expert.
I have installed APACHE on my Win98 machine to use for local testing of web sites prior to deploying them with my hosting company. I have numerous sites on the go at any one time and want to be able to set up APACHE so that I can access them all by either entering a different domain name i.e. http://mysite1/ http://mysite2/ http://mysite3/ or by using ports Http://localhost:9000/ Http://localhost:9001/ Http://localhost:9002/ can some one tell me (in lots of detail!!) how to set up my "httpd.conf" file to acheive this. I have no local DNS so the solution must not rely on one. Thanks in advance.... Richard Last edited by benbun : September 6th, 2001 at 04:12 PM. |
|
#2
|
|||
|
|||
|
>> I have no local DNS so the solution must not rely on one
Then use C:\Windows\Hosts file. Just put: 127.0.0.1 localhost mysite1 mysite2 mysite3 This file doesn't exist by default, so create it manually. |
|
#3
|
|||
|
|||
|
Great - I'll give that a try !!.
How do I set up APACHE so that each doimain uses a different root directory. RK |
|
#4
|
|||
|
|||
|
NameVirtualHost 192.168.1.2
<VirtualHost 192.168.1.2> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/host1" ServerName host1 serveralias www.host1.com </VirtualHost> <Directory "D:/Program Files/Apache Group/Apache/htdocs/host1"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <VirtualHost 192.168.1.2> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/host2" ServerName host2 ServerAlias www.host2.com </VirtualHost> <Directory "D:/Program Files/Apache Group/Apache/htdocs/host2"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Setup your host file as described by wizard freebsd
__________________
\Oliver For those about to php - we salute you! |
|
#5
|
|||
|
|||
|
Ok, I have set up my HOSTS file and it works perfectly.
I now have several "domains" than point ot the same site. The next step was to set up the virtual hosts so they point to different places. My httpd.conf file is shown below (relevant bit) NameVirtualHost 127.0.0.1 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *> # ServerAdmin webmaster@dummy-host.example.com # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #</VirtualHost> <VirtualHost 127.0.0.1> DocumentRoot "D:\BenBun Web Services\benbun05" ServerName benbun serveralias www.benbun.com </VirtualHost> <Directory "D:\BenBun Web Services\benbun05"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <VirtualHost 127.0.0.1> DocumentRoot "D:\BenBun Web Services\Site - NCL" ServerName bbws1 ServerAlias www.bbws1.com </VirtualHost> <Directory "D:\BenBun Web Services\Site - NCL"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> This works fine. Entering http://benbun shows site #1 http://bbws1 shows site #2 The problem is that for bbws1 to work I need to be connected to the internet, even though it is served from my local PC. Why does it insist on connecting to the web ?. Any ideas appreciated. Richard |
|
#6
|
|||
|
|||
|
You C:\Windows\Hosts then needs to be:
127.0.0.1 localhost benbun bbws1 www.benbun.com www.bbws1.com If bbws1 is not found in Hosts file, it will query your nameserver for the answer. Even if you put a real domain like www.yahoo.com to your Hosts file, it should work. |
|
#7
|
||||
|
||||
|
I too would like to learn about setting up apache for virtualhost
I understand most of what was explained except the part about c:\windows\host file. I have the virtualhost setup but when I type the http://host1 I get the cannot find server. My question? What kind of file is the host file and where does it need to be placed. Thanks in advance. Johnny |
|
#8
|
|||
|
|||
|
>> What kind of file is the host file
That's for resolving non-routable IP to hostname (LAN or local). With that properly setup, you should be able to ping those hostname and it should return the mapped IP accordingly. Apache listens to all NIC by default, including internal, external or even loopback. That said, for external, it relies on querying nameserver (DNS). For internal, you just need to setup hosts file (on each box you want the hostname to be resolvable). In order to setup vhosts in Apache, the vhost's hostname MUST be resolvable, whether it's external or internal. >> where does it need to be placed In Win9x -> C:\Windows\Hosts In WinNT/2K/XP -> C:\WinNT\System32\drivers\etc\Hosts In Linux/BSD/UNIX -> /etc/hosts (case-sensitive) Last edited by freebsd : September 9th, 2001 at 06:02 AM. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > APACHE / Win98 / Virtual Hosts. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|