You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Steve <sm...@mho.net> on 2002/01/05 06:39:19 UTC

httpd.conf

Dear users,

I have followed many of the recommended paths for information on
VirtualHosts, specifically name-based virtual hosts, but I can't seem to
make my configuration work the way I intend - any help would be greatly
appreciated.

Facts:
I am a standard user (not <root>, and no admin priviledges> on a Linux
installation (like http://linux.mho.org). I was able to
download/compile/install Apache 1.3.12 in my own directory structure and can
run the http server on port 8080. I have registered two domain names and
forwarded the names to the IP address of the (ficticious) address above...
no problem.

Here's the challenge:
My NameVirtualHost points to my IP address (excluding the port).
I use the Listen directive to cover port 8080 (and 9000 just for
excitement).
In each of my two (2) <VirtualHost> containers, I have ServerName,
DocumentRoot, and ServerAlias defined - one (1) for port 8080 (default) and
the other for port 9000.

Now, when I try to access my URL, I get (following the example above)
http://linux.mho.org:8080 in the address bar, and the correct content that I
point it to (using DocumentRoot). But the second <VirtualHost> doesn't
appear to work (for my other registered name and settings).

-> How can I set up my httpd.conf to accept requests for www.smartin.com and
www.martins.com using the same IP address?

tia!!!

Steve



---------------------------------------------------------------------
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


RE: httpd.conf (repost)

Posted by Steve <sm...@mho.net>.
Thanks for the help Owen... my configuration looks very much like your
suggestion - without the port designation. Problem still remains, even
though I added the port. When I try to access the second site, I still get
the content from the directory in the first <VirtualHost> container.

The reason I want to know how to capture the request, is so I can configure
my <VirtualHost> to match the request... instead of the other way around.

Thank you again! All help is greatly appreciated.

Steve

-----Original Message-----
From: obo@bourse.ch [mailto:obo@bourse.ch]
Sent: Wednesday, January 09, 2002 6:22 AM
To: users@httpd.apache.org
Subject: Re: httpd.conf <VirtualHost> (repost)


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



---------------------------------------------------------------------
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


Re: httpd.conf (repost)

Posted by Owen Boyle <ob...@bourse.ch>.
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


RE: httpd.conf (repost)

Posted by Steve <sm...@mho.net>.
<you wrote>
I may be *way* off on this, but don't you simply need to set your router up
to point http traffic from port 8080 at your server?

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.

-Darrel
</>

I am getting my configuration to work without specifying the port - at least
the server doesn't complain - but I still can't get to my second
<VirtualHost>.

Question below still pending...

> -> 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
> 2> what would my <VirtualHost> entry(s) look like?
>
> Bonus question, How do I tell which request is coming? (i.e. s-martin.com
> <or> martin-s.com)
>
> Thanks for any help
>
> Steve


---------------------------------------------------------------------
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


Re: httpd.conf (repost)

Posted by Darrel Austin <da...@visi.com>.
I may be *way* off on this, but don't you simply need to set your router up
to point http traffic from port 8080 at your server?

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.

-Darrel

on 1/6/02 6:47 PM, Steve at smartin@mho.net wrote:

> -> 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:8080,
> s-martin.com = 192.168.0.1:8080
> martin-s.com = 192.168.0.1:8080
> 
> 1> what would my NamveVirtualHost entry(s) look like
> 2> what would my <VirtualHost> entry(s) look like?
> 
> Bonus question, How do I tell which request is coming? (i.e. s-martin.com
> <or> martin-s.com)
> 
> Thanks for any help
> 
> Steve
> 
> 
> ---------------------------------------------------------------------
> 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
> 


---------------------------------------------------------------------
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


httpd.conf (repost)

Posted by Steve <sm...@mho.net>.
-> 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:8080,
s-martin.com = 192.168.0.1:8080
martin-s.com = 192.168.0.1:8080

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

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

Thanks for any help

Steve


---------------------------------------------------------------------
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