You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by romeo <ro...@despammed.com> on 2004/03/09 05:06:58 UTC
[users@httpd] servername in VirtualHost
Hi. I have Apache 1.3.28 on W2K with php.
If I visit my local site with it's domain and a trailing slash
( example.com/b/ )all links are ok. It shows me a "fancy" index ( i have
no index file in there).
But if I visit example.com/b the links go to 127.0.0.1
I have one virtual host defined, I think that the server should use the
servername in the Vhost to create the autoreferencing link in the second
case. Right? Thanks in advance for your comments. Bye.
httpd.conf:
no listen directives
no bindaddress
port 80
ServerName 127.0.0.1
UseCanonicalName Off
### Section 3: Virtual Hosts
NameVirtualHost example.com
<VirtualHost example.com>
ServerAlias *.example.com
ServerAdmin admin@my.domain
DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
ServerName example.com
</VirtualHost>
---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] servername in VirtualHost
Posted by Jez Hancock <je...@munk.nu>.
On Tue, Mar 09, 2004 at 12:06:58AM -0400, romeo wrote:
> If I visit my local site with it's domain and a trailing slash
> ( example.com/b/ )all links are ok. It shows me a "fancy" index ( i have
> no index file in there).
>
> But if I visit example.com/b the links go to 127.0.0.1
This is no surprise, you're asking apache for the file called 'b' that
resides in the document root - unless you put a trailing '/' on the
request, you won't get the directory contents of 'b'.
> I have one virtual host defined, I think that the server should use the
> servername in the Vhost to create the autoreferencing link in the second
> case. Right? Thanks in advance for your comments. Bye.
>
> httpd.conf:
>
> no listen directives
> no bindaddress
>
> port 80
If you have virtual host entries set up you can remove this from the
main part of the config file:
> ServerName 127.0.0.1
In any event it doesn't make a lot of sense anyway - f you really want
something like this use:
ServerName localhost
> UseCanonicalName Off
>
> ### Section 3: Virtual Hosts
>
Change this to the _IP address_ (NOT fully qualified domain name) you
want to do name based vhosting on:
> NameVirtualHost example.com
ie if you just want to use any available address:port, use:
NameVirtualHost *:*
Change this to the interface you want to host the vhost on:
> <VirtualHost example.com>
ie if you want to host it on any available address:port, use:
<VirtualHost *:*>
> ServerAlias *.example.com
> ServerAdmin admin@my.domain
> DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
> ServerName example.com
> </VirtualHost>
--
Jez Hancock
- System Administrator / PHP Developer
http://munk.nu/
http://jez.hancock-family.com/ - Another FreeBSD Diary
http://ipfwstats.sf.net/ - ipfw peruser traffic logging
---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: [despammed] [users@httpd] servername in VirtualHost
Posted by romeo <ro...@despammed.com>.
> But if I visit example.com/b the links go to 127.0.0.1
I used samspade's safe web browser. It shows that the server sends a
well formed link with the trailing slash in a 301 error. So only I can
see this issue. I wonder why.
---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] servername in VirtualHost
Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 9 Mar 2004, romeo wrote:
> NameVirtualHost example.com
>
> <VirtualHost example.com>
> ServerAlias *.example.com
> ServerAdmin admin@my.domain
> DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
> ServerName example.com
> </VirtualHost>
I don't understand why people use a config like this. None of the apache
docs suggest this.
Replace example.com with *:80 in the NameVirtualHost and VirtualHost
directives and things should work.
Joshua.
---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org