# Apache: Several Problems!

## overbored

Hi, I'm a newbie to Gentoo (and Apache) and I just installed openssh, vim, apache2, mod_perl, and mod_php onto an otherwise empty system. (And I added apache2 to the default runlevel with rc-update.) I have barely touched the configuration files. Currently I'm experiencing three issues, but maybe they're related.

Problem 1: Subdirectories

My first problem: I can access the default page ("Seeing this instead of the website you expected?") from elsewhere on the LAN (accessing http://192.168.2.101/ from 192.168.2.102). However, when I try to access something http://192.168.2.101/~joe/, the browser can't even connect. MSIE returns a page titled "Cannot find server" and whose main header is "This page cannot be displayed." (At first I was getting a Forbidden error on ~joe, but after doing a chmod on /home/joe, I get this new error instead.)

When I try to access http://192.168.2.101/manual/, I get a 500 Internal Server Error. The following shows up in my error_log:

```

[Tue Feb 24 10:12:13 2004] [error] [client 192.168.2.102] Syntax error in type map, no ':' in /var/www/localhost/htdocs/manual/index.html for header     <title>apache http server version 1.3 documentation</title>

</head>

```

BUT when I access http://192.168.2.101/~joe/blah/, it works (and tells me Forbidden because I haven't enabled directory listing, which is fine). Then when I access http://192.168.2.101/~joe/ again, it also says Forbidden (instead of refusing to accept the connection as before). What's going on???

Problem 2: Multiple Daemons

Another problem is that, right after a reboot, I have a shload of apaches running:

```

root      4409  0.0  1.9 26044 9976 ?        S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4455  0.0  1.6 25464 8612 ?        S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4495  0.0  2.0 26312 10424 ?       S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4496  0.0  1.9 26044 10008 ?       S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4497  0.0  1.9 26044 10004 ?       S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4498  0.0  1.9 26044 10004 ?       S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4499  0.0  1.9 26044 10004 ?       S    00:25   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

apache    4509  0.0  1.9 26044 10004 ?       S    00:27   0:00 /usr/sbin/apache2 -k start -D SSL -D PHP4

```

Is this normal?

Problem 3: Restarting the Daemon

Lastly, I can't start, stop, or restart the daemon. It always works fine right after a reboot (except for of course the above problems). But running "apache2ctl restart" doesn't work. The following input:

```

shutdown -r now

apache2ctl stop

apache2ctl start

```

produces the following output (in /var/log/apache2/error_log, with my annotations in angle brackets):

```

<reboot>

[Tue Feb 24 00:25:07 2004] [notice] Digest: generating secret for digest authentication ...

[Tue Feb 24 00:25:07 2004] [notice] Digest: done

[Tue Feb 24 00:25:08 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48 OpenSSL/0.9.7c PHP/4.3.4 configured -- resuming normal operations

<apache2ctl stop>

[Tue Feb 24 00:34:53 2004] [notice] caught SIGTERM, shutting down

<apache2ctl start>

[Tue Feb 24 00:35:20 2004] [notice] Digest: generating secret for digest authentication ...

```

It never finishes generating a digest; I gave it a good 15 minutes. During this time, my browser would just wait on http://192.168.2.101/ indefinitely. Another "apache2ctl stop" spits out (on stdout):

```

httpd (no pid file) not running

```

and nothing in the error_log. This is despite the fact that "ps aux" shows:

```

root      4568  0.0  1.6 25468 8596 ?        S    00:35   0:00 /usr/sbin/apache2 -D SSL -D PHP4 -k start

```

I also tried using apache2 -k, but to no avail. Same as before.

Configurations

Here are all the relevant configuration/log files/etc I could think of:

/etc/hostname:

```

athlon1400

```

/etc/hosts:

```

127.0.0.1 athlon1400

192.168.2.101 athlon1400

...

```

/etc/apache2/conf/apache2.conf:

```

ServerRoot /etc/apache2

ServerName athlon1400

PidFile /var/run/apache2.pid

ErrorLog logs/error_log

LogLevel warn

DocumentRoot /var/www/localhost/htdocs

...

```

/etc/conf.d/apache2

```

APACHE2_OPTS="-D SSL -D PHP4"

```

qpkg -I:

```

app-admin/syslog-ng *

app-arch/bzip2 *

app-arch/cabextract *

app-arch/cpio *

app-arch/gzip *

app-arch/ncompress *

app-arch/sharutils *

app-arch/tar *

app-arch/unzip *

app-crypt/mhash *

app-editors/nano *

app-editors/vim *

app-editors/vim-core *

app-portage/gentoolkit *

app-shells/bash *

app-shells/sash *

app-text/aspell *

app-text/sablotron *

dev-lang/perl *

dev-lang/python *

dev-libs/expat *

dev-libs/glib *

dev-libs/libmcrypt *

dev-libs/libol *

dev-libs/libpcre *

dev-libs/libxml2 *

dev-libs/libxslt *

dev-libs/mm *

dev-libs/openssl *

dev-libs/popt *

dev-libs/ucl *

dev-perl/Crypt-SSLeay *

dev-perl/Digest-MD5 *

dev-perl/HTML-Parser *

dev-perl/HTML-Tagset *

dev-perl/MIME-Base64 *

dev-perl/URI *

dev-perl/XML-Parser *

dev-perl/digest-base *

dev-perl/libnet *

dev-perl/libwww-perl *

dev-perl/mod_perl *

dev-php/mod_php *

dev-php/php *

dev-python/python-fchksum *

dev-util/ctags *

dev-util/dialog *

dev-util/yacc *

media-gfx/bootsplash *

media-libs/fontconfig *

media-libs/freetype *

media-libs/giflib *

media-libs/jpeg *

media-libs/lcms *

media-libs/libmng *

media-libs/libpng *

media-libs/libungif *

media-libs/pdflib *

media-libs/t1lib *

media-libs/tiff *

net-libs/libwww *

net-mail/mailbase *

net-mail/postfix *

net-misc/dhcpcd *

net-misc/iputils *

net-misc/openssh *

net-misc/rsync *

net-misc/wget *

net-print/cups *

net-www/apache *

sys-apps/acl *

sys-apps/attr *

sys-apps/baselayout *

sys-apps/coreutils *

sys-apps/cronbase *

sys-apps/debianutils *

sys-apps/diffutils *

sys-apps/ed *

sys-apps/fbset *

sys-apps/file *

sys-apps/findutils *

sys-apps/gawk *

sys-apps/grep *

sys-apps/groff *

sys-apps/hdparm *

sys-apps/help2man *

sys-apps/hotplug *

sys-apps/kbd *

sys-apps/less *

sys-apps/man *

sys-apps/man-pages *

sys-apps/miscfiles *

sys-apps/module-init-tools *

sys-apps/modutils *

sys-apps/net-tools *

sys-apps/pam-login *

sys-apps/pciutils *

sys-apps/portage *

sys-apps/procps *

sys-apps/psmisc *

sys-apps/sed *

sys-apps/setserial *

sys-apps/shadow *

sys-apps/slocate *

sys-apps/tcp-wrappers *

sys-apps/texinfo *

sys-apps/usbutils *

sys-apps/util-linux *

sys-apps/vixie-cron *

sys-apps/which *

sys-boot/grub *

sys-devel/autoconf *

sys-devel/automake *

sys-devel/bc *

sys-devel/bin86 *

sys-devel/binutils *

sys-devel/bison *

sys-devel/flex *

sys-devel/gcc *

sys-devel/gcc-config *

sys-devel/gettext *

sys-devel/gnuconfig *

sys-devel/libperl *

sys-devel/libtool *

sys-devel/m4 *

sys-devel/make *

sys-devel/patch *

sys-fs/devfsd *

sys-fs/e2fsprogs *

sys-fs/reiserfsprogs *

sys-kernel/genkernel *

sys-kernel/gentoo-dev-sources *

sys-kernel/linux-headers *

sys-libs/cracklib *

sys-libs/db *

sys-libs/gdbm *

sys-libs/glibc *

sys-libs/gpm *

sys-libs/ncurses *

sys-libs/pam *

sys-libs/pwdb *

sys-libs/readline *

sys-libs/zlib *

x11-base/opengl-update *

x11-base/xfree *

x11-libs/qt *

x11-misc/ttmkfdir *

```

Anyway, I *really* hope to get the Web server up and running soon, so thanks in advance for any help!

----------

## overbored

OK, so it's normal to have mutliple daemons running. This is specified in apache2.conf, under the prefork.c part (MinSpareServers, MaxSpareServers).

However, when I restart apache, only one daemon comes back up. (And only sort of, at that...see problem 3.)

----------

## ross8653

i had problems with my sub directories when i tried to access something outside of the document root

your documentroot is /var/www/localhost/htdocs so apache might only beable to access stuff under that (you dont want people accessing http://192.168.2.101/../../.. do you?)

the simple solution is trying making a sym link (ln -s) to /home/joe called "~joe" and see if that works, it worked for me, as for your other problems i doubt i can help but have you tried /etd/init.d/apache2 restart  ?

btw my digest authentication took less than a second

----------

## ross8653

update: a non sucky solution

check your /etc/apache2/conf/commonapache2.conf

scroll down 2-3 pages and check "userdir:"

### UserDir: The name of the directory which is appended onto a user's home

### directory if a ~user request is recieved.

<IfModule mod_userdir.c>

     UserDir public_html

</IfModule>

so you could instead make that "." or in each user's dir make a symlink called public_html linked to "."

but your errors are because in the same config commonapache2.conf you have to specifically allow which directories apache can serve documents from.  So you can add a <Directory /> tag based on the examples

----------

