DocumentRoot weirdness (to me anyway)

DocumentRoot weirdness (to me anyway)

am 14.06.2007 11:29:46 von pokhara

I am running apache 2.2 on Debian.

I put the following at the end of my /etc/apache2/apache2.conf file

DocumentRoot "/var/www/sam" (I omitted the trailing / as advised)

and restarted the service using

kill -USR1 `cat /var/run/apache2.pid`

however if i enter http://192.168.0.3 it defaults to

http://192.168.0.3/apache2-default/

and serves up

/var/www/apache2-default/index.html

However if I enter http://192.168.0.3/index.html

then it serves up /var/www/index.html

I want it to serve up /var/www/sam/index.html when i enter http://192.168.0.3

or http://192.168.0.3/index.html

At present it serves up 2 different index.html files neither of which
i want.

Re: DocumentRoot weirdness (to me anyway)

am 14.06.2007 11:56:57 von HansH

"pokhara67" schreef in bericht
news:1181813386.711161.167050@q19g2000prn.googlegroups.com.. .
>I am running apache 2.2 on Debian.
> I put the following at the end of my /etc/apache2/apache2.conf file
> DocumentRoot "/var/www/sam" (I omitted the trailing / as advised)
On Debian Apache comes configured with virtualhosts and IIRC thus
documentroot in server context is either ignored or overruled per vhost.

> and restarted the service using
> kill -USR1 `cat /var/run/apache2.pid`
/etc/init.d/apache2 restart
or
apache2ctl -k restart
are more convinient ways to restart apache

> however if i enter http://192.168.0.3 it defaults to
> http://192.168.0.3/apache2-default/
>
> and serves up
> /var/www/apache2-default/index.html
That's a condig tweak [by Debian] to give you apaches manual unless an
index file exists: /etc/apache2/conf.d/apache2-doc
This folder is included into the config at line 137 of
/etc/apache2/apache20.conf

> However if I enter http://192.168.0.3/index.html
> then it serves up /var/www/index.html
Most likely, that's the default vhost configed at
/etc/apache2/sites-available/ and actived by symlink at
/etc/apache2/sites-enabled/ .

Commonly -and initially- vhosts do not work with IPs, you need to name them.
http://httpd.apache.org/docs/2.2/vhosts/name-based.html

> I want it to serve up /var/www/sam/index.html when i enter
> http://192.168.0.3
There is a thin line between 'want to' and 'need to' ...
http://httpd.apache.org/docs/2.2/vhosts/ip-based.html


Hans

Re: DocumentRoot weirdness (to me anyway)

am 14.06.2007 12:57:32 von pokhara

On Jun 14, 10:56 am, "HansH" wrote:
> "pokhara67" schreef in berichtnews:1181813386.711161.167050@q19g2000prn.googlegroup s.com...>I am running apache 2.2 on Debian.
> > I put the following at the end of my /etc/apache2/apache2.conf file
> > DocumentRoot "/var/www/sam" (I omitted the trailing / as advised)
>
> On Debian Apache comes configured with virtualhosts and IIRC thus
> documentroot in server context is either ignored or overruled per vhost.
>
> > and restarted the service using
> > kill -USR1 `cat /var/run/apache2.pid`
>
> /etc/init.d/apache2 restart
> or
> apache2ctl -k restart
> are more convinient ways to restart apache
>
> > however if i enterhttp://192.168.0.3it defaults to
> >http://192.168.0.3/apache2-default/
>
> > and serves up
> > /var/www/apache2-default/index.html
>
> That's a condig tweak [by Debian] to give you apaches manual unless an
> index file exists: /etc/apache2/conf.d/apache2-doc
> This folder is included into the config at line 137 of
> /etc/apache2/apache20.conf
>
> > However if I enterhttp://192.168.0.3/index.html
> > then it serves up /var/www/index.html
>
> Most likely, that's the default vhost configed at
> /etc/apache2/sites-available/ and actived by symlink at
> /etc/apache2/sites-enabled/ .
>
> Commonly -and initially- vhosts do not work with IPs, you need to name them.http://httpd.apache.org/docs/2.2/vhosts/name-based.html
>
> > I want it to serve up /var/www/sam/index.html when i enter
> >http://192.168.0.3
>
> There is a thin line between 'want to' and 'need to' ...http://httpd.apache.org/docs/2.2/vhosts/ip-based.html
>
> Hans

thanks


If you want to change the default document root directory in apache2
you have to modify /etc/apache2/sites-available/default file.Edit
this file and change the path to where ever you want to change.

which is what you said.

Re: DocumentRoot weirdness (to me anyway)

am 14.06.2007 13:01:22 von pokhara

On Jun 14, 11:57 am, pokhara67 wrote:
> On Jun 14, 10:56 am, "HansH" wrote:
>
>
>
> > "pokhara67" schreef in berichtnews:1181813386.711161.167050@q19g2000prn.googlegroup s.com...>Iam running apache 2.2 on Debian.
> > > I put the following at the end of my /etc/apache2/apache2.conf file
> > > DocumentRoot "/var/www/sam" (I omitted the trailing / as advised)
>
> > On Debian Apache comes configured with virtualhosts and IIRC thus
> > documentroot in server context is either ignored or overruled per vhost.
>
> > > and restarted the service using
> > > kill -USR1 `cat /var/run/apache2.pid`
>
> > /etc/init.d/apache2 restart
> > or
> > apache2ctl -k restart
> > are more convinient ways to restart apache
>
> > > however if i enterhttp://192.168.0.3itdefaults to
> > >http://192.168.0.3/apache2-default/
>
> > > and serves up
> > > /var/www/apache2-default/index.html
>
> > That's a condig tweak [by Debian] to give you apaches manual unless an
> > index file exists: /etc/apache2/conf.d/apache2-doc
> > This folder is included into the config at line 137 of
> > /etc/apache2/apache20.conf
>
> > > However if I enterhttp://192.168.0.3/index.html
> > > then it serves up /var/www/index.html
>
> > Most likely, that's the default vhost configed at
> > /etc/apache2/sites-available/ and actived by symlink at
> > /etc/apache2/sites-enabled/ .
>
> > Commonly -and initially- vhosts do not work with IPs, you need to name them.http://httpd.apache.org/docs/2.2/vhosts/name-based.html
>
> > > I want it to serve up /var/www/sam/index.html when i enter
> > >http://192.168.0.3
>
> > There is a thin line between 'want to' and 'need to' ...http://httpd.apache.org/docs/2.2/vhosts/ip-based.html
>
> > Hans
>
> thanks
>
> If you want to change the default document root directory in apache2
> you have to modify /etc/apache2/sites-available/default file.Edit
> this file and change the path to where ever you want to change.
>
> which is what you said.

I also found that if you comment out the line

Include /etc/apache2/sites-enabled/

to

#Include /etc/apache2/sites-enabled/

then

DocumentRoot "/var/www/sam"

works

Re: DocumentRoot weirdness (to me anyway)

am 14.06.2007 14:31:58 von HansH

"pokhara67" schreef in bericht
news:1181818882.813014.295090@i13g2000prf.googlegroups.com.. .
>> If you want to change the default document root directory in apache2
>> you have to modify /etc/apache2/sites-available/default file.Edit
>> this file and change the path to where ever you want to change.
>>
>> which is what you said.
>
> I also found that if you comment out the line
> Include /etc/apache2/sites-enabled/
> then
>
> DocumentRoot "/var/www/sam"
>
> works
>
Within the Debian framework of a modular configuration, that's not a good
thing: the next update is likely to override your changes!

Consider removing the symlink(s) at /etc/apache2/sites-enabled/
and create a file at /etc/apache2/conf.d/
to hold your line "DocumentRoot "/var/www/sam""

HansH