VirtualHost & UseCanonicalName Off

VirtualHost & UseCanonicalName Off

am 01.01.2010 20:39:14 von Bill Gradwohl

On my Fedora 12 laptop, I'm trying to set up a WEB site development
environment to mimic my real web server that contains several virtual
hosts. On my laptop I want the Apache server to respond to Firefox's
requests to http://localhost/somedomain.com and haul up what my local
development site looks like.

I've set up the following in the httpd.conf:

....
....
UseCanonicalName Off
....
NameVirtualHost *:80

ServerAdmin xxxx@ycc.com
DocumentRoot /var/www/html/roatanbakery.com
ServerName roatanbakery.com:80
ErrorLog /var/log/httpd/roatanbakery.com-error_log
CustomLog /var/log/httpd/roatanbakery.com-access_log common

AllowOverride Options
XBitHack On
Options Indexes MultiViews +Includes
Order allow,deny
allow from all




ServerAdmin xxxx@ycc.com
DocumentRoot /var/www/html/ycc.com
ServerName ycc.com:80
ErrorLog /var/log/httpd/ycc.com-error_log
CustomLog /var/log/httpd/ycc.com-access_log common

AllowOverride Options
XBitHack On
Options Indexes MultiViews +Includes
Order allow,deny
allow from all




httpd -S reports:
root@billlaptop # httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 billlaptop.private.ycc
(/etc/httpd/conf.d/ssl.conf:75)
*:80 is a NameVirtualHost
default server roatanbakery.com (/etc/httpd/conf/httpd.conf:1001)
port 80 namevhost roatanbakery.com
(/etc/httpd/conf/httpd.conf:1001)
port 80 namevhost ycc.com (/etc/httpd/conf/httpd.conf:1027)
Syntax OK


Via Firefox, if I key in
http://localhost
I get the roatanbakery.com web site on my box. If, however, I key in
http://localhost/roatanbakery.com
I get:
Not Found

The requested URL /roatanbakery.com/ was not found on this server.
Apache/2.2.14 (Fedora) Server at billlaptop Port 80
Same for http://localhost/ycc.com

I'm apparently getting the default virtual host by using a non specific
http request to the localhost. As soon as I try to be specific it won't
work, even though the httpd -S says it recognizes the 2 virtual domains,
and the default and the specific request point at the same virtual area.

My reading of the docs for UseCanonicalName Off says that this should
work. Trying to wget these virtuals also doesn't work, so I know its
something to do with the Apache configuration, but I don't see what's wrong.

Any help would be appreciated.
Thank You

--
Bill Gradwohl

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: VirtualHost & UseCanonicalName Off

am 13.01.2010 10:35:35 von Matus UHLAR - fantomas

On 01.01.10 13:39, Bill Gradwohl wrote:
> On my Fedora 12 laptop, I'm trying to set up a WEB site development
> environment to mimic my real web server that contains several virtual
> hosts. On my laptop I want the Apache server to respond to Firefox's
> requests to http://localhost/somedomain.com and haul up what my local
> development site looks like.
[...]
> NameVirtualHost *:80
>
> ServerAdmin xxxx@ycc.com
> DocumentRoot /var/www/html/roatanbakery.com
> ServerName roatanbakery.com:80
[...]
>

[...]
> httpd -S reports:
> root@billlaptop # httpd -S
> VirtualHost configuration:
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 billlaptop.private.ycc
> (/etc/httpd/conf.d/ssl.conf:75)
> *:80 is a NameVirtualHost
> default server roatanbakery.com (/etc/httpd/conf/httpd.conf:1001)
> port 80 namevhost roatanbakery.com
> (/etc/httpd/conf/httpd.conf:1001)
> port 80 namevhost ycc.com (/etc/httpd/conf/httpd.conf:1027)
> Syntax OK

> Via Firefox, if I key in
> http://localhost
> I get the roatanbakery.com web site on my box. If, however, I key in
> http://localhost/roatanbakery.com
> I get:
> Not Found

apparently there is no /var/www/html/roatanbakery.com/roatanbakery.com
folder/file available.

Note that "roatanbakery.com" is the default virtual host, so any unknown
virtual server is treated as if you requested roatanbakery.com.
Therefore by asking for localhost/roatanbakery.com you ask for
roatanbakery.com/roatanbakery.com which doesn't exist.

> My reading of the docs for UseCanonicalName Off says that this should
> work.

the UseCanonicalName only cares about server redirects. IF you turned it
off, you would apparently get error that roatanbakery.com/roatanbakery.com
doesn't exist but the result would be the same.

> Trying to wget these virtuals also doesn't work, so I know its
> something to do with the Apache configuration, but I don't see what's wrong.

you can create virtual host named "localhost" pointing to
/var/www/html. Note that you'll be able to see any content under
that directory, unless you disable it other directives.

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
A day without sunshine is like, night.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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