1 votes

Apache2 s'arrête de fonctionner de manière aléatoire, erreur 403

Je viens d'installer un serveur Ubuntu personnel sur mon lieu de travail, pour tester nos sites web php. Il s'agit d'une version 12.04 LTS à jour avec LAMP et Samba installés. Je l'ai configuré pour qu'il fonctionne avec le répertoire /home/administrateur/www comme répertoire par défaut DocumentRoot.

Je l'ai fait : j'ai ajouté l'utilisateur www-data dans le groupe administrateur, j'ai donné récursivement les permissions ug+rwx sur admin/.

J'ai changé la racine par défaut en /home/administrateur/www dans /etc/apache2/sites-available/default.

Jusqu'à présent, tout va bien... mais apache redémarre tous les jours, une ou plusieurs fois, et ensuite, je ne peux pas accéder aux sites web et j'obtiens l'erreur 403. Le dossier www/, qui est habituellement disponible via notre réseau local, n'est plus accessible. Mais lorsque je me connecte au serveur avec putty, tout se passe bien à nouveau. C'est vraiment bizarre.

Mon journal d'erreurs ressemble à ceci pour ce matin :

PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/ming.ini on line 1 in Unknown on line 0
\[Sun Mar 02 06:51:47 2014\] \[notice\] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations
\[Mon Mar 03 09:10:45 2014\] \[crit\] \[client 192.168.30.15\] (13)Permission denied: /home/administrateur/.htaccess pcfg\_openfile: unable to check htaccess file, ensure it is readable
\[Mon Mar 03 09:10:45 2014\] \[crit\] \[client 192.168.30.15\] (13)Permission denied: /home/administrateur/.htaccess pcfg\_openfile: unable to check htaccess file, ensure it is readable
\[Mon Mar 03 09:10:45 2014\] \[crit\] \[client 192.168.30.15\] (13)Permission denied: /home/administrateur/.htaccess pcfg\_openfile: unable to check htaccess file, ensure it is readable
\[Mon Mar 03 09:47:55 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/favicon.ico
\[Mon Mar 03 09:47:55 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/favicon.ico
\[Mon Mar 03 09:50:51 2014\] \[notice\] Graceful restart requested, doing restart
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/ming.ini on line 1 in Unknown on line 0
\[Mon Mar 03 09:50:52 2014\] \[notice\] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations
\[Mon Mar 03 09:52:09 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/slideshare-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:52:09 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/twitter-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:52:09 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/fb-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:53:00 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/fb-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:53:00 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/twitter-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:53:00 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/slideshare-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:53:42 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/fb-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:53:42 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/twitter-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 09:53:42 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/slideshare-logo-24.png, referer: http://test.atd13.nm/
\[Mon Mar 03 11:48:39 2014\] \[error\] \[client 192.168.30.51\] Erreur de la base de donn\\xc3\\xa9es WordPress You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea$
\[Mon Mar 03 11:48:46 2014\] \[error\] \[client 192.168.30.51\] Erreur de la base de donn\\xc3\\xa9es WordPress You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea$
\[Mon Mar 03 11:49:03 2014\] \[error\] \[client 192.168.30.51\] Erreur de la base de donn\\xc3\\xa9es WordPress You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea$
\[Mon Mar 03 16:39:10 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/censier/favicon.ico
\[Mon Mar 03 16:39:10 2014\] \[error\] \[client 192.168.30.15\] File does not exist: /home/administrateur/www/censier/favicon.ico
\[Tue Mar 04 06:34:26 2014\] \[notice\] Graceful restart requested, doing restart
Warning: DocumentRoot \[/home/administrateur/www\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/adrexo\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/atd13\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/adrexo-blog\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/censier\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/friendship\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/nouvelle-marque\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/philanthropie\] does not exist
Warning: DocumentRoot \[/home/administrateur/www/wordpress\] does not exist
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/ming.ini on line 1 in Unknown on line 0
\[Tue Mar 04 06:34:26 2014\] \[notice\] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.10 with Suhosin-Patch configured -- resuming normal operations
\[Tue Mar 04 09:10:09 2014\] \[crit\] \[client 192.168.30.15\] (13)Permission denied: /home/administrateur/.htaccess pcfg\_openfile: unable to check htaccess file, ensure it is readable
\[Tue Mar 04 09:10:09 2014\] \[crit\] \[client 192.168.30.15\] (13)Permission denied: /home/administrateur/.htaccess pcfg\_openfile: unable to check htaccess file, ensure it is readable
\[Tue Mar 04 09:10:09 2014\] \[crit\] \[client 192.168.30.15\] (13)Permission denied: /home/administrateur/.htaccess pcfg\_openfile: unable to check htaccess file, ensure it is readable

Voici mon fichier /etc/apache2/sites-available/default

        ServerAdmin f.lebas@nouvellemarque.com

DocumentRoot /home/administrateur/www

                Options FollowSymLinks
                AllowOverride All

                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from All

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all

        ErrorLog ${APACHE\_LOG\_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE\_LOG\_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"

        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128

et ici, mon apache2.conf

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do \*not\* begin
# with "/", the value of ServerRoot is prepended -- so "foo.log"
# with ServerRoot set to "/etc/apache2" will be interpreted by the
# server as "/etc/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at );
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
LockFile ${APACHE\_LOCK\_DIR}/accept.lock

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE\_PID\_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
## 

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves

    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
#              graceful restart. ThreadLimit can only be changed by stopping
#              and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves

    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves

    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0

# These need to be set in /etc/apache2/envvars
User ${APACHE\_RUN\_USER}
Group ${APACHE\_RUN\_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#

    Order allow,deny
    Deny from all
    Satisfy all

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
# It is also possible to omit any default MIME type and let the
# client's browser guess an appropriate action instead. Typically the
# browser will decide based on the file's extension then. In cases
# where no good assumption can be made, letting the default MIME type
# unset is suggested  instead of forcing the browser to accept
# incorrect  metadata.
#
DefaultType None

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a 
# container, error messages relating to that virtual host will be
# logged here.  If you \*do\* define an error logfile for a 
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE\_LOG\_DIR}/error.log

#
# LogLevel: Control the number of messages logged to the error\_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include mods-enabled/\*.load
Include mods-enabled/\*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" vhost\_combined
LogFormat "%h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined
LogFormat "%h %l %u %t \\"%r\\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/

# mod rewrite

        RewriteEngine On

et un ls -lah /home/administrateur/www/ me donne :

drwxrwx--- 21 administrateur administrateur 4,0K févr. 26 14:00 .
drwxrwx---  6 administrateur administrateur 4,0K mars   4 10:08 ..
drwxrwx---  7 administrateur administrateur 4,0K févr. 26 14:02 adrexo
drwxrwx---  6 administrateur administrateur 4,0K févr. 25 17:14 adrexo-blog
drwxrwx---  6 administrateur administrateur 4,0K févr. 26 13:58 adrexo-blog-corpo
drwxrwx---  5 administrateur administrateur 4,0K févr. 19 16:10 adrexo-blog\_save
drwxrwx---  5 administrateur administrateur 4,0K févr. 19 16:10 adrexo\_save
drwxrwx---  5 administrateur administrateur 4,0K mars   3 10:10 atd13
drwxrwx---  5 administrateur administrateur 4,0K mars   3 16:39 censier
drwxrwx---  5 administrateur administrateur 4,0K févr. 19 16:25 censier\_test
drwxrwx---  5 administrateur administrateur 4,0K févr. 19 16:10 croix-rouge
drwxrwx---  6 administrateur administrateur 4,0K févr. 20 19:11 friendship
-rwxrwx---  1 administrateur administrateur   19 févr. 24 16:48 index.php
drwxrwx---  5 administrateur administrateur 4,0K août   9  2011 nouvellemarque
drwxrwx---  5 administrateur administrateur 4,0K févr. 18 18:47 nouvelle-marque
drwxrwx---  5 administrateur administrateur 4,0K févr. 24 17:24 philanthropie
drwxrwx---  5 administrateur administrateur 4,0K févr. 19 16:32 philanthropie\_
drwxrwx--- 23 administrateur administrateur  12K mai   30  2013 prestashop
drwxrwx---  5 administrateur administrateur 4,0K févr. 19 16:12 sandbox
drwxrwx---  5 administrateur administrateur 4,0K août   9  2011 surlepont
drwxrwx---  2 administrateur administrateur 4,0K févr. 18 15:38 vhosts ne pas effacer
drwxrwx---  5 administrateur administrateur 4,0K févr. 24 17:44 wordpress

Merci de votre aide

3voto

Michael Hampton Points 232226

Il sons comme vous avez peut-être choisi de crypter votre répertoire personnel lors de l'installation d'Ubuntu.

Si c'est le cas, votre répertoire personnel n'est accessible qu'une fois que vous vous êtes connecté à l'ordinateur et, une fois que vous vous êtes déconnecté, il cesse d'être accessible peu après.

Cette configuration n'est pas appropriée pour un répertoire à partir duquel des fichiers doivent être servis à tout moment. crypter l'ensemble du disque dur avec une phrase d'authentification au démarrage. (Notez que cela n'était pas disponible dans la version 12.04 LTS et ne l'est devenu que dans la version 12.10).

Pour revenir à cette situation , essayez ecryptfs-setup-private --undo qui vous donnera la marche à suivre pour annuler un répertoire personnel crypté.

1voto

snowdude Points 2790

L'entrée du journal indique une erreur critique et la solution :

Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

Cela ressemble à des permissions erronées sur un fichier .htaccess ou à des permissions insuffisantes pour qu'apache puisse, dans votre répertoire personnel, effectuer un listage des répertoires pour vérifier si un tel fichier existe.

Je pense que vous ne voulez pas qu'Apache cherche un fichier htaccess à cet endroit, mais la raison pour laquelle Apache vérifie l'existence d'un fichier htaccess dans votre répertoire personnel également et pas seulement dans le sous-répertoire www est étrange, peut-être à cause de la spécification de votre DocumentRoot ?

DocumentRoot /home/administrateur/www

devrait être

DocumentRoot "/home/administrateur/www"

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X