Apache Server configuration support - Defaultpage in Apache2

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > July 2006 > Defaultpage in Apache2





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Defaultpage in Apache2
Jonathan Heinen

2006-07-19, 7:27 pm

Hi,

I'm using apache2 with the a2enablesite tool on my debian server. I have
lot of domains and subdomains.
If I use a wrong subdomain apache shows one of my domains. I tried to
make apache show a page I build to give the user a list of domains on my
server but I wasn't able to make apache show that page!
I tried a lot ... changed the name of the default page-config to start
with 0 so it's the first page in the orthographly sorted list! But it
doesn't work ... i diabled all site and start to enable the sites with
the default site but it doesnt work for me!

So can you help me? I think what I want to do isn't any special think o no?

Jonathan
Davide Bianchi

2006-07-20, 7:56 am

On 2006-07-19, Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> wrote:
> If I use a wrong subdomain apache shows one of my domains. I tried to
> make apache show a page I build to give the user a list of domains on my
> server but I wasn't able to make apache show that page!


If apache can't find the virtual host you request, he will use the
_default_ one if you have one defined as _default_ or he will use the
first one defined. So, define a virtualhost as default (or first one)
that will only show the error page.

Davide

--
Failure is not an option. It comes bundled with your Microsoft product.
--Ferenc Mantfeld
Jonathan Heinen

2006-07-20, 7:27 pm

Hi Davide,

I just read before that I have to define the default as first! But I
tried to change the order of my sites but I was'nt able!

So you wrote that there is an other possibilidy by definding the default
host! How can I realize that?

Thanks

Jonathan


Davide Bianchi schrieb:
> If apache can't find the virtual host you request, he will use the
> _default_ one if you have one defined as _default_ or he will use the
> first one defined. So, define a virtualhost as default (or first one)
> that will only show the error page.
>
> Davide
>

Davide Bianchi

2006-07-21, 7:36 am

On 2006-07-20, Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> wrote:
> So you wrote that there is an other possibilidy by definding the default
> host! How can I realize that?


<VirtualHost _default_ ...>

Davide

--
If Microsoft were to vanish, who would we hate next?
-- From a Slashdot.org post
Jonathan Heinen

2006-07-21, 7:27 pm

Hi,

I changed Davide Bianchi schrieb:
> On 2006-07-20, Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> wrote:
>
> <VirtualHost _default_ ...>
>
> Davide
>

<VirtualHost *>

to

<VirtualHost default *>
and
<VirtualHost default>
and
<VirtualHost * default>

but always I got the error message from Apache that a VirtualHost with
the name default does not exsist!

Jonathan



Davide Bianchi

2006-07-21, 7:27 pm

On 2006-07-21, Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> wrote:
><VirtualHost *>
>
> to
>
><VirtualHost default *>
> and
><VirtualHost default>
> and
><VirtualHost * default>
>
> but always I got the error message from Apache that a VirtualHost with
> the name default does not exsist!


See the documentation:
http://httpd.apache.org/docs/2.0/vh...es.html#default

Davide

--
Grown-up Operative System: old enough to drink, old enough to vote,
old enough to drive, old enough to fsck
- Brian Kantor and Anthony de Boer on asr
Jonathan Heinen

2006-07-22, 7:47 am

Hi,

Sorry that I understood you wrong! And thanks fpr the link =)
But my Problem is that I use name-based vhosts! =(
And like the dokumetaion sais:

A default vhost never serves a request that was sent to an address/port
that is used for name-based vhosts. If the request contained an unknown
or no Host: header it is always served from the primary name-based vhost
(the vhost for that address/port appearing first in the configuration file).

So it can not work for me!
Like the dokumentation sais the first Virtual Host is the default one!
But I use one file per VNameHost so I doesn't have any controll abaut
which VHost is the default one =( ...

Jonathan



> On 2006-07-21, Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> wrote:
>
> See the documentation:
> http://httpd.apache.org/docs/2.0/vh...es.html#default
>
> Davide
>



HansH

2006-07-22, 1:21 pm

"Jonathan Heinen" <Jonathan.Heinen@rwth-aachen.de> schreef in bericht
news:4iei7qF3g926U1@news.dfncis.de...

> So it can not work for me!
> Like the dokumentation sais the first Virtual Host is the default one!
> But I use one file per VNameHost so I doesn't have any controll abaut
> which VHost is the default one =( ...

AFAIK those files are loaded in a sorted order, probably a simple ASCII
order, possibly OSdependant.
So name the file holding the line <VirtualHost _default_ *> '_default_',
will likely have it loaded first -always-.
Apache is redistributed by some *nix flavours -Debian to name one- this way.
Others add a two digit number before any of these files, thus 00_default_,
01www.first.domain upto 99.dev.last.domain.

The unfortunate or paranoid may consider to include <VirtualHost _default_
*>...</VirtualHost> into their main config file just above the line 'Include
/path/toyour/vhostdefinitons/' instead.

HansH


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com