You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tom Evans <te...@googlemail.com> on 2010/07/13 15:42:28 UTC
Re: [users@httpd] how to disable default site from being served in
apache2
On Tue, Jul 13, 2010 at 1:34 PM, Tapas Mishra <mi...@gmail.com> wrote:
> I am having some websites and by default a website whose vhost
> configuration is first alphanumerically is being served.
> I do not want this to happen.
> i.e. when I am typing http://192.168.1.5/
> by default a website is being served
> instead I need is some thing here which shows me different directories
> as in those directories I have different websites which I later want
> to serve.
>
When using name based virtual hosting, if no VirtualHost container has
a ServerName that matches the requested Host header, then the first
vhost encountered in the conf file is used.
Commonly, people set up the first vhost as a 'failure' vhost, that
people only visit if they request a vhost that is not configured,
which can then be used to redirect people on to the right vhost or
display an appropriate error message.
Cheers
Tom
---------------------------------------------------------------------
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] how to disable default site from being served in
apache2
Posted by Tom Evans <te...@googlemail.com>.
On Tue, Jul 13, 2010 at 4:31 PM, Tapas Mishra <mi...@gmail.com> wrote:
> In this setup you have assumed server name default.
> In case I want a request when does not match any of the ServerNames
> I need to have a server name which is generating a redirect to an
> index page which asks user to enter correct URL
> do you mean this by above.
>
'ServerName default' is a reminder that this is the default vhost, its
not listing all the server names it will respond to.
Any request with Host: default will go to the first vhost
Any request with Host: foobar will go to the vhost that has ServerName
foobar, unless there is none with that name, in which case it will go
to the first vhost.
Once again, this is discussed in the docs. Read the docs:
http://httpd.apache.org/docs/2.2/vhosts/details.html
Tom
---------------------------------------------------------------------
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] how to disable default site from being served in
apache2
Posted by Tapas Mishra <mi...@gmail.com>.
In this setup you have assumed server name default.
In case I want a request when does not match any of the ServerNames
I need to have a server name which is generating a redirect to an
index page which asks user to enter correct URL
do you mean this by above.
---------------------------------------------------------------------
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] how to disable default site from being served in
apache2
Posted by Tom Evans <te...@googlemail.com>.
On Tue, Jul 13, 2010 at 3:21 PM, Tapas Mishra <mi...@gmail.com> wrote:
> On Tue, Jul 13, 2010 at 7:12 PM, Tom Evans <te...@googlemail.com> wrote:
>
>
>> Commonly, people set up the first vhost as a 'failure' vhost, that
>> people only visit if they request a vhost that is not configured,
>> which can then be used to redirect people on to the right vhost or
>> display an appropriate error message.
> Can you give me an example or link for this.
>
> --
> Tapas
>
<VirtualHost *:80>
ServerName default
Redirect / http://proper-site.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.foo.com
...
</VirtualHost>
Tom
---------------------------------------------------------------------
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] how to disable default site from being served in
apache2
Posted by Tapas Mishra <mi...@gmail.com>.
On Tue, Jul 13, 2010 at 7:12 PM, Tom Evans <te...@googlemail.com> wrote:
> Commonly, people set up the first vhost as a 'failure' vhost, that
> people only visit if they request a vhost that is not configured,
> which can then be used to redirect people on to the right vhost or
> display an appropriate error message.
Can you give me an example or link for this.
--
Tapas
---------------------------------------------------------------------
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