httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <...@bourse.ch>
Subject Re: httpd.conf <VirtualHost> (repost)
Date Wed, 09 Jan 2002 13:22:03 GMT
Steve wrote:
> 
> AFAIK (and I've been asking similar questions lately) port mapping has
> nothing to do with VirtualHosts. VirtualHosts are simple for pointing
> multiple URLs at one IP address/Machine.

Virtual Hosting is whenever a single instance of the webserver serves
two separate sites. It can be:

- name-based: Sites have different names but same IP and port
- port-based: sites have same IP but different ports
- IP-based: sites have different IPs 

Only for name-based do you need the NameVirtualHost directive. 

for example, consider the user's original question:

> > -> How can I set up my httpd.conf to accept requests for www.s-martin.com
> > and
> > www.martin-s.com using the same IP address?
> >
> > For instance: I forward/redirect two registered names to 192.168.0.1,
> > s-martin.com = 192.168.0.1
> > martin-s.com = 192.168.0.1
> >
> > 1> what would my NamveVirtualHost entry(s) look like

NamveVirtualHost 192.168.0.1:80

> > 2> what would my <VirtualHost> entry(s) look like?

<VirtualHost 192.168.0.1:80>
  ServerName s-martin.com
  DocumentRoot /home/html/s-martin-stuff
  TransferLog  logs/s-martin_access_log
</VirtualHost>

<VirtualHost 192.168.0.1:80>
  ServerName martin-s.com
  DocumentRoot /home/html/martin-s-stuff
  TransferLog  logs/martin-s_access_log
</VirtualHost>

> > Bonus question, How do I tell which request is coming? (i.e. s-martin.com
> > <or> martin-s.com)

See use of different TransferLogs above.

PS: This assumes the user has different content to serve on the two
sites. If in fact they are just aliases of the same site then he only
needs one VH;

<VirtualHost 192.168.0.1:80>
  ServerName  s-martin.com
  ServerAlias martin-s.com
  DocumentRoot /home/html/s-martin-stuff
  TransferLog  logs/s-martin_access_log
</VirtualHost>

Rgds,

Owen Boyle.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message