<?xml version='1.0' encoding="UTF-8"?>
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/nl/apache-troubleshooting.xml,v 1.3 2012/06/30 18:42:54 swift Exp $ -->
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">

<guide disclaimer="obsolete" lang="nl">
<title>Troubleshooting Apache</title>

<author title="Autheur">
  <mail link="vericgar@gentoo.org">Michael Stewart</mail>
</author>
<author title="Medewerker">
  <mail link="beu@gentoo.org">Elfyn McBratney</mail>
</author>
<author title="Medewerker">
  <mail link="kloeri@gentoo.org">Bryan Østergaard</mail>
</author>
<author title="Vertaler">
  <mail link="alexander_zuliani@telenet.be">Alexander Zuliani</mail>
</author>

<abstract>
Dit document behandelt een aantal methodes om uit te zoeken wat er fout is met
je apache installatie, en ze te fixen.
</abstract>

<!-- The content of this document is licensed under the CC-BY-SA license -->
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
<license/>

<version>1.5</version>
<date>2005-10-24</date>

<chapter>
<title>De logs controleren</title>
<section>
<body>

<p>
Als er iets mis is met Apache, maar geen idee hebt wat het kan zijn, kun je wat
aanwijzingen vinden in de log bestanden.
</p>

<p>
Er zijn een aantal verschillende logfiles. Je vindt ze allemaal in
<path>/var/log/apache2/</path>. Niet alle logs zul je vinden op jouw systeem,
dit is afhankelijk va nde geïnstalleerde modules.
</p>

</body>
</section>

<section>
<title>access_log</title>
<body>

<pre caption="access_log">
67.185.0.236 - - [18/Jun/2005:12:05:50 -0700] "GET / HTTP/1.0" 200 721
10.0.1.80 - - [18/Jun/2005:12:11:07 -0700] "GET /~jaspenelle/__journal1.jpg HTTP/1.1" 200 19079
66.239.233.163 - - [18/Jun/2005:12:15:06 -0700] "GET /~jaspenelle/avy14.gif HTTP/1.0" 200 1661
67.185.60.155 - - [18/Jun/2005:12:18:48 -0700] "GET / HTTP/1.0" 200 721
67.185.0.236 - - [18/Jun/2005:12:25:39 -0700] "GET / HTTP/1.0" 200 721
10.0.1.80 - - [18/Jun/2005:12:28:04 -0700] "GET /~jaspenelle/avy14.gif HTTP/1.1" 200 1661
10.0.1.80 - - [18/Jun/2005:12:28:46 -0700] "GET /~jaspenelle/avy7.png HTTP/1.1" 200 13066
</pre>

<p>
Dit bestand is gewoon een lijst met ieder bestand dat opgevraagd is van je
server. Als je niets aan je configuratie veranderd hebt, is dit in "Common Log"
formaat:
</p>

<pre caption="Common Log Formaat syntax">
remotehost rfc931 authuser [date] "request" status bytes
</pre>

<table>
<tr>
  <ti>remotehost</ti>
  <ti>Externe hostname of ip-adres</ti>
</tr>
<tr>
  <ti>rfc931</ti>
  <ti>De externe loginnaam van de gebruiker.</ti>
</tr>
<tr>
  <ti>authuser</ti>
  <ti>De gebruikersnaam waarmee de gebruiker zich heeft geïdentificeerd.</ti>
</tr>
<tr>
  <ti>[date]</ti>
  <ti>Datum en tijd van het verzoekt.</ti>
</tr>
<tr>
  <ti>"request"</ti>
  <ti>De aanvraag, precies zoals de cient hem stuurdet.</ti>
</tr>
<tr>
  <ti>status</ti>
  <ti>De HTTP status code die de client terugkreeg.</ti>
</tr>
<tr>
  <ti>bytes</ti>
  <ti>De grootte van het verzonden document.</ti>
</tr>
</table>

</body>
</section>
<section>
<title>error_log</title>
<body>

<pre caption="error_log">
[Mon Feb 07 23:33:18 2005] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)
[Mon Feb 07 23:33:18 2005] [notice] Digest: generating secret for digest authentication ...
[Mon Feb 07 23:33:18 2005] [notice] Digest: done
[Mon Feb 07 23:33:18 2005] [notice] Apache/2.0.52 (Gentoo/Linux) PHP/4.3.10 configured -- resuming normal operations
[Sat Jun 18 13:01:54 2005] [error] [client 10.0.1.80] File does not exist: /var/www/localhost/htdocs/favicon.ico
[Sat Jun 18 13:02:14 2005] [error] [client 10.0.1.80] File does not exist: /var/www/localhost/htdocs/favicon.ico
[Sat Jun 18 13:02:18 2005] [error] [client 10.0.1.80] File does not exist: /var/www/localhost/htdocs/favicon.ico
[Sat Jun 18 13:02:21 2005] [error] [client 10.0.1.80] File does not exist: /var/www/localhost/htdocs/favicon.ico
[Sat Jun 18 13:02:24 2005] [error] [client 10.0.1.80] File does not exist: /var/www/localhost/htdocs/favicon.ico
</pre>

<p>
Zoals je ziet, kan dit bestand veel gegevens bevatten, afhankelijk van de
<c>ErrorLevel</c> instelling in je <path>httpd.conf</path> bestand. Het verteld
je of apache juist is opgestart, welke fouten het tegenkwam, ... Algemeen zegt
het je alles wat fout gegaan is. Als iets niet goed werkt, is dit het nuttigste
bestand voor meer informatie.
</p>

</body>
</section>
<section>
<title>suexec_log</title>
<body>

<pre caption="suexec_log">
[2005-02-11 22:33:19]: uid: (1000/vericgar) gid: (1000/1000) cmd: test.cgi
[2005-03-11 19:20:13]: uid: (1000/vericgar) gid: (1000/1000) cmd: test.cgi
[2005-03-11 19:34:47]: uid: (1000/vericgar) gid: (1000/1000) cmd: test.cgi
</pre>

<p>
Dit bestand bevat een regel voor elke keer een CGI script draait en "suexec"
gebruikt. Als je een script niet werkend krijgt met suexec, is dit het nuttigste
bestand aangezien het over het algemeen een regel heeft die stelt waarom het
script niet uitgevoerd werd.
</p>

</body>
</section>
</chapter>

<chapter>
<title>Ik heb een module geïnstalleerd, maar ze werkt niet!!!</title>
<section>
<body>

<p>
Een module installeren is niet voldoende, je moet nog expliciet vermelden dat je
ze wilt activeren. We doen dit om het aan- en afleggen van modules eenvoudig te
houden, wat het simpeler maakt om uit te vissen welke modules problemen
veroorzaaken.
</p>

<p>
Als je een module installeerd, zou het een melding zolas deze moeten geven:
</p>

<pre caption="Post-installatie bericht van emerge">
 *
 * To enable mod_layout, you need to edit your /etc/conf.d/apache2 file and
 * add '-D LAYOUT' to APACHE2_OPTS.
 *
 *
 * Configuration file installed as
 *     /etc/apache2/modules.d/15_mod_layout.conf
 * You may want to edit it before turning the module on in /etc/conf.d/apache2
 *
</pre>

<p>
Dit is nogal vanzelfsprekend. Het zegt je precies wat je moet doen om deze
module te activeren.
</p>

<p>
Als je dit bericht niet hebt gelezen, is er nog een manier om te achterhalen wat
je moet toevoegen aan <c>APACHE3_OPTS</c>in <path>/etc/conf.d/apache2</path>:
Controleer gewoon het configuratiebestand dat werdt toegevoegd in
<path>/etc/apache2/modules.d/</path>. Zoek naar een regel met <c>IfDefine</c>:
</p>

<pre caption="Een stukje uit 15_mod_layout.conf">
&lt;IfDefine LAYOUT&gt;
  &lt;IfModule !mod_layout.c&gt;
    LoadModule layout_module    modules/mod_layout.so
  &lt;/IfModule&gt;
&lt;/IfDefine&gt;
</pre>

<p>
Het IfDefine stukje wordt geparsed als je <c>-D LAYOUT</c> toevoegt aan
<path>/etc/conf.d/apache2</path>. <c>LAYOUT</c> is slechts een voorbeeld.
</p>

<p>
Er zijn verschillende opties die je kunt toevoegen aan <c>APACHE2_OPTS</c> die
in de standaardconfiguratie staan:
</p>

<table>
<tr>
  <th>Optie</th>
  <th>Resultaat</th>
</tr>
<tr>
  <ti>USERDIR</ti>
  <ti>
    Activeert de public_html folders van gebruikers zodat ze toegankelijk zijn
    via http://server/~username
  </ti>
</tr>
<tr>
  <ti>INFO</ti>
  <ti>
    Activeert de mod_info module, die informatie over de draaiende
    serverconfiguratie geeft via http://localhost/server-info
  </ti>
</tr>
<tr>
  <ti>PROXY</ti>
  <ti>Activeert mod_proxy</ti>
</tr>
<tr>
  <ti>SSL</ti>
  <ti>
    Start SSL/HTTPS ondersteuning. (Apache moet gecompiled zijn met de ssl
    USE-Flag)
  </ti>
</tr>
<tr>
  <ti>DAV</ti>
  <ti>Activeert mod_dav, de ingebouwde WebDav module</ti>
</tr>
<tr>
  <ti>DAV_FS</ti>
  <ti>Activeert mod_dav_fs, ondersteuning voor bestandsystemen in WebDav</ti>
</tr>
<tr>
  <ti>LDAP</ti>
  <ti>
    Activeert mod_ldap, die Apache de mogelijkheid geeft om te verbinden naar
    LDAP bronnen. (Vereist de ldap USE-vlag)
  </ti>
</tr>
<tr>
  <ti>AUTH_LDAP</ti>
  <ti>Activeert authenticatie via een LDAP server.</ti>
</tr>
</table>

<p>
Documentatie voor alle ingebouwde modules kun je vinden in de <uri
link="http://httpd.apache.org/docs-2.0/">Apache 2.0 documentatie</uri>.
</p>

</body>
</section>
</chapter>

<chapter>
<title>Apache geeft lege pagina's weer of segfault</title>
<section>
<body>

<p>
Dit gebeurt meestal na een upgrade omdat binaire compatibiliteit gebroken is in
APR (Wat door verschillende dingen kan gebeuren). Om dit te vermaken, moet je de
apache tool stack hercompilen:
</p>

<pre caption="De Apache tool stack hercompilen">
<comment>(Doe dit in de juiste volgorde, belangerijk!)</comment>

<comment>(Eerst verwijderen we de huidige installatie)</comment>
# <i>emerge -aCv '=net-www/apache-2*'</i>

<comment>(Dan hercompilen we de toolstack)</comment>
# <i>emerge -av '=dev-libs/apr-0*' '=dev-libs/apr-util-0*'</i>

<comment>(Daarna herinstalleren we apache)</comment>
# <i>emerge -av '=net-www/apache-2*'</i>

<comment>(Dependencies zoeken)</comment>
$ <i>equery depends net-www/apache</i>
[ Searching for packages depending on net-www/apache... ]
dev-php/phpsysinfo-2.3-r2
dev-php/phpsysinfo-2.1-r2
dev-php/mod_php-4.3.11-r2
net-www/mod_layout-4.0.1a-r1
www-servers/gorg-0.5

<comment>(Alle geïnstalleerde modules hercompilen)</comment>
# <i>emerge -av '=dev-php/mod_php-4.3.11-r2' '=net-www/mod_layout-4.0.1.a-r1'</i>
</pre>

</body>
</section>
<section>
<title>Een buggy add-on bepalen</title>
<body>

<p>
Als je hierna nog steeds problemen hebt, dan is de schuldige waarschijnlijk een
van de add-on modules.
</p>

<p>
Begin met alle modules te verwijderen, en herstart Apache.
</p>

<pre caption="Add-on modules uitschakelen">
<comment>(pas /etc/conf.d/apache2 aan)</comment>

<comment>(voor de wijziging)</comment>
APACHE2_OPTS="-D PHP4 -D USERDIR -D SSL"

<comment>(na de wijziging)</comment>
APACHE2_OPTS=""
</pre>

<pre caption="Apache herstarten">
# <i>/etc/init.d/apache2 stop</i>
<comment>(Zorg ervoor dat Apache zeker afligt)</comment>
# <i>ps -A</i>
# <i>/etc/init.d/apache2 start</i>
</pre>

<note>
Het kan gebeuren dat je in je configuratie kleine wijzigingen moet aanbrengen
als je <c>Directive</c>s hebt die niet controleren of de modules geladen zijn.
Het is aan te raden dat deze <c>Directive</c>s binnen test containers geplaatst
worden. Bekijk een .conf bestand in <path>/etc/apache2/modules.d</path> voor een
voorbeeld.
</note>

<p>
Als apache nu niet meer segfault of lege pagina's geeft, ben je zeker dat een
van de add-on's het doen. Om uit te zoeken welke, voeg je ze een voor een toe,
en herstart je apache volledig.
</p>

<p>
Als Apache niet meer werkt na een bepaalde module, weet je dat dat degene is die
de problemen veroorzaakt. Soms kan de module simpelweg hercompilen dit oplossen.
</p>

<p>
Als na het hercompilen en herstarten van apache je nog steeds problemen hebt,
moet je <uri link="http://bugs.gentoo.org">een bug filen</uri> die de specifieke
versie en revisie van de module geven, en zeggen dat ze segfault. Maar zorg
ervoor dat je eerst zoekt of die bug nog niet bestaat!
</p>

</body>
</section>
</chapter>

<chapter>
<title>De webserver parsed geen PHP of CGI code maar geeft gewoon hun
code</title>
<section>
<body>

<p>
Apache geeft soms gewoon de PHP of CGI code weer in de plaats ze te draaien en
de output te geven. Als dit gebeurt, hoewel de module geactiveerd is in
<path>/etc/cinf.d/apache2</path> is het zeer waarschijnlijk een cache probleem.
De webbrowser's cache kuisen kan dit client-side probleem oplossen.
</p>

<p>
Soms kan dit probleem ook voorkomen als je de webserver benaderd via zijn DNS
naam maar niet als je dit doet via zijn IP adres. Dit is een sterke aanwijzing
in de richting van een cache-probleem.
</p>

<p>
Dit probleem kan verholpen worden door de webbrowser's cache te legen, en die
van webproxies zoals squid of wwwoffle.
</p>

</body>
</section>
</chapter>

<chapter>
<title>configure: error: changes in the environment can compromise the build</title>
<section>
<body>

<p>
Als je deze error krijgt, heb je waarschijnlijk onnodige spaties in je
<c>CFLAGS</c> in <path>/etc/make.conf</path>. Vermaken is simpel, verwijder de
extra spaties:
</p>

<pre caption="Voorbeeld van varanderingen in /etc/make.conf">
<comment>(Voor de wijziging)</comment>
CFLAGS="-O2 -mcpu=pentium3 -march=pentium3  -pipe"

<comment>(Na de wijziging, let op de spaties)</comment>
CFLAGS="-O2 -mcpu=pentium3 -march=pentium3 -pipe"
</pre>

</body>
</section>
</chapter>

<chapter>
<title>Address already in use: make_sock: could not bind to address 0.0.0.0:443</title>
<section>
<body>

<p>
Dit probleem kan zich voordoen tijdens het starten en betekend dat je
verschillende <c>Listen</c> instructies hebt in je configuratie die incompatibel
zijn. Om dit op te lossen, moet je je configuratie greppen voor <c>Listen</c> en
ze stuk voor stuk vermaken.
</p>

<pre caption="Alle Listen directives zoeken">
<comment>(Zorg dat je in de juiste directory bent.)</comment>
# <i>cd /etc/apache2/</i>

<comment>(Zoek alle Listen directives)</comment>
# <i>grep Listen httpd.conf vhosts.d/*.conf modules.d/*.conf</i>
</pre>

<p>
Je zoekt conflicterende Listen entries, bijvoorbeelt, als er een
<c>Listen 80</c> in <path>httpd.conf</path> is en een <c>Listen 10.0.0.15:80</c>
in een andere, kan apche niet starten. Dit is omdat apache eerst probeert te
binden op poort 80 op alle IP's, en dan op poort 80 voor IP adres 10.0.0.15 en
dit niet kan omdat poort 80 al in gebruik is.
</p>

<p>
De aan te raden configuratie is dat je één <c>Listen 80</c> (Dit is de standaard
in <path>httpd.conf</path>) maakt en dan voor elke SSL <c>VirtualHost</c> je een
aparte absoluute <c>Listen</c> directive aanmaakt (Bijvoorbeeld: <c>Listen
10.0.0.15:443</c>).
</p>

</body>
</section>
</chapter>

<chapter>
<title>Na een upgrade naar apache-2.0.54-r13 werken de standaard vhosts niet
meer</title>
<section>
<body>

<p>
Sinds de update naar apache-2.0.54-r13 zijn er twee directives toegevoegd door
<uri link="http://bugs.gentoo.org/show_bug.cgi?id=100624">Bug 100624</uri>.
</p>

<p>
De nieuwe directives zijn <c>-D DEFAULT_VHOST</c> om de standaard vhost te
activeren en <c>-D SSL_DEFAULT_VHOST</c> om de standaard SSL vhost te activeren.
Bijden moeten toegevoegd worden aan <c>APACHE2_OPTS</c> in
<path>/etc/conf.d/apache2</path> als je wil dat Apache weer werkt als vroeger.
</p>

</body>
</section>
</chapter>

<chapter id="getting-help">
<title>Hulp zoeken</title>
<section>
<body>

<p>
Als niets van deze dingen hielpen, of je hebt andere vragen, kom dan eens langs
in on IRC channel, <path>#gentoo-apache</path> op <path>irc.freenode.net</path>.
Of post een bug op <uri link="http://bugs.gentoo.org">Gentoo's Bugzilla</uri>.
</p>

</body>
</section>
</chapter>

</guide>
