Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 11/07/2017, à 21:12

SHHP

Apache -- Erreur 500

Bonjour bonsoir. J'ai un problème avec mon serveur: il indique une erreur (500), vous pouvez la voir ici: http://babbofan.fr
C'est depuis que j'ai changé le répertoire des DocumentRoot afin d'avoir une connexion ftp. Je ne sais pas si c'est la session ubuntu (celle actuellement utilisée) ou autre chose qui restreint l'accès.
Voici mon fichier apache2.conf

# 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.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#       /etc/apache2/
#       |-- apache2.conf
#       |       `--  ports.conf
#       |-- mods-enabled
#       |       |-- *.load
#       |       `-- *.conf
#       |-- conf-enabled
#       |       `-- *.conf
#       `-- sites-enabled
#               `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.

# Global configuration
#

# 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 Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# 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.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# 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


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# 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 <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

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

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /home/ubuntu/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted

#</Directory>




# 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.
#
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
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
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Hors ligne

#2 Le 12/07/2017, à 10:15

bruno

Re : Apache -- Erreur 500

Bonjour,

Une erreur 500 c'est souvent une erreur de configuration d'Apache.
Pourquoi as-tu modifié le fichier apache2.conf ? En général on ne touche pas à ce fichier ; la configuration se fait dans les fichiers d'hôtes virtuels.

Hors ligne

#3 Le 12/07/2017, à 10:43

SHHP

Re : Apache -- Erreur 500

Même sans le modifier, l'erreur était déjà là. Je pourrais avoir le fichier original ?

Hors ligne

#4 Le 12/07/2017, à 10:50

bruno

Re : Apache -- Erreur 500

Le fichier original est dans le paquet apache2, mais normalement on prend toujours la précaution de faire une copie d'un fichier de configuration avant de le modifier.

Si tu veux voir les éventuelles erreurs de configuration :

sudo apache2ctl -t

Mais l'erreur 500 peut aussi être due à un script du site qui bloque. Il faut regarder les logs d’apache.

Dernière modification par bruno (Le 12/07/2017, à 10:51)

Hors ligne

#5 Le 12/07/2017, à 11:08

SHHP

Re : Apache -- Erreur 500

Ok, mais sinon par reprendre le fichier original, il y a un site ou autre chose ?

Hors ligne

#6 Le 12/07/2017, à 12:47

bruno

Re : Apache -- Erreur 500

A priori tu n'as fait qu'une seule modification dans apache2.conf, donc tu modifies cette ligne :

<Directory /home/ubuntu/www/>

en

<Directory /var/www/>

et tu retrouvera le me fichier qu'à l'origine. Mais ce n'est apparemment pas ce fichier qui provoque l'erreur 500.

Il faut donner les retours demandés en #4 (commande et logs).

Dernière modification par bruno (Le 12/07/2017, à 12:48)

Hors ligne

#7 Le 12/07/2017, à 16:05

SHHP

Re : Apache -- Erreur 500

Voici le fichier d'erreur:

[Wed Jul 12 06:25:02.102051 2017] [mpm_prefork:notice] [pid 23941] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Wed Jul 12 06:25:02.102109 2017] [core:notice] [pid 23941] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jul 12 06:42:26.447495 2017] [:error] [pid 32704] [client 168.1.128.62:10000] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/ww$
[Wed Jul 12 06:42:26.447695 2017] [:error] [pid 32704] [client 168.1.128.62:10000] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/ub$
[Wed Jul 12 07:06:27.155729 2017] [:error] [pid 32705] [client 95.213.177.125:10161] script '/home/ubuntu/www/azenv.php' not found or unable to stat, referer: https://proxyradar.com/
[Wed Jul 12 08:21:59.088805 2017] [:error] [pid 32703] [client 109.89.196.30:50920] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:21:59.088988 2017] [:error] [pid 32703] [client 109.89.196.30:50920] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:21:59.666215 2017] [:error] [pid 32708] [client 109.89.196.30:50922] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:21:59.666296 2017] [:error] [pid 32708] [client 109.89.196.30:50922] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:21:59.844827 2017] [:error] [pid 32704] [client 109.89.196.30:50924] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:21:59.844889 2017] [:error] [pid 32704] [client 109.89.196.30:50924] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:21:59.971999 2017] [:error] [pid 387] [client 109.89.196.30:50926] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/www$
[Wed Jul 12 08:21:59.972102 2017] [:error] [pid 387] [client 109.89.196.30:50926] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/ubu$
[Wed Jul 12 08:22:00.124973 2017] [:error] [pid 32705] [client 109.89.196.30:50928] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:22:00.125052 2017] [:error] [pid 32705] [client 109.89.196.30:50928] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:22:00.266208 2017] [:error] [pid 32706] [client 109.89.196.30:50930] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:22:00.266264 2017] [:error] [pid 32706] [client 109.89.196.30:50930] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:22:00.501276 2017] [:error] [pid 32703] [client 109.89.196.30:50932] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:22:00.501323 2017] [:error] [pid 32703] [client 109.89.196.30:50932] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:22:00.625224 2017] [:error] [pid 32708] [client 109.89.196.30:50934] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 08:22:00.625370 2017] [:error] [pid 32708] [client 109.89.196.30:50934] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 08:58:34.246102 2017] [:error] [pid 387] [client 199.30.228.154:38571] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/ww$
[Wed Jul 12 08:58:34.246365 2017] [:error] [pid 387] [client 199.30.228.154:38571] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/ub$
[Wed Jul 12 09:11:22.187609 2017] [:error] [pid 32705] [client 82.251.241.242:51884] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/$
[Wed Jul 12 09:11:22.187750 2017] [:error] [pid 32705] [client 82.251.241.242:51884] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/$
[Wed Jul 12 09:44:04.019768 2017] [:error] [pid 32703] [client 109.89.196.30:51744] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 09:44:04.020150 2017] [:error] [pid 32703] [client 109.89.196.30:51744] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 09:51:41.931677 2017] [:error] [pid 32708] [client 94.231.166.35:59154] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Jul 12 09:51:41.931730 2017] [:error] [pid 32708] [client 94.231.166.35:59154] PHP Fatal error:  Unknown: Failed opening required '/home/ubuntu/www/admin/index.php' (include_path='.:/usr/share/php')$
[Wed Jul 12 10:06:20.147484 2017] [:error] [pid 32705] [client 209.126.136.4:52532] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/w$
[Wed Jul 12 10:06:20.147733 2017] [:error] [pid 32705] [client 209.126.136.4:52532] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/u$
[Wed Jul 12 11:20:35.678955 2017] [:error] [pid 32706] [client 95.213.177.125:9888] script '/home/ubuntu/www/azenv.php' not found or unable to stat, referer: https://proxyradar.com/
[Wed Jul 12 11:22:20.002658 2017] [:error] [pid 32703] [client 94.231.166.35:58210] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Jul 12 11:22:20.002765 2017] [:error] [pid 32703] [client 94.231.166.35:58210] PHP Fatal error:  Unknown: Failed opening required '/home/ubuntu/www/admin/index.php' (include_path='.:/usr/share/php')$
[Wed Jul 12 13:27:43.852954 2017] [:error] [pid 32705] [client 86.210.161.158:54034] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/$
[Wed Jul 12 13:27:43.853153 2017] [:error] [pid 32705] [client 86.210.161.158:54034] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/$
[Wed Jul 12 14:53:16.460345 2017] [:error] [pid 32703] [client 60.169.78.57:33507] PHP Warning:  require(/home/ubuntu/www/includes/config.php): failed to open stream: Permission denied in /home/ubuntu/ww$
[Wed Jul 12 14:53:16.460658 2017] [:error] [pid 32703] [client 60.169.78.57:33507] PHP Fatal error:  require(): Failed opening required 'includes/config.php' (include_path='.:/usr/share/php') in /home/ub$

En fait, j'ai changé le répertoire pour le site web sur /home/ubuntu/www/ sinon, impossible de se connecter en root

Hors ligne

#8 Le 12/07/2017, à 16:24

HPIR40

Re : Apache -- Erreur 500

Bonjour

qui est le proprio de /home/ubuntu/www ?

normalement cela doit etre www-data:www-data et comme tu l'a déplacé si cela se trouve le proprio c'est toi ou root.

un petit

chown -R www-data:www-data /home/ubuntu/www

devrait résoudre le problème du permission denied

Dernière modification par HPIR40 (Le 12/07/2017, à 16:30)

Hors ligne

#9 Le 12/07/2017, à 16:38

bruno

Re : Apache -- Erreur 500

Effectivement il faut vérifier les droits d'accès.
Sur une configuration « classique » il faut que l'utilisateur www-data ait au moins les droits en lecture sur tous les fichiers et dossiers sous /home/ubuntu/www

Et tu n'as pas besoin de te « connecter en root » pour faire du FTP ! Cela me paraît très risqué !

Hors ligne

#10 Le 12/07/2017, à 16:43

jplemoine

Re : Apache -- Erreur 500

HPIR40 a écrit :

normalement cela doit etre www-data:www-data

Surtout pas. Il faut juste que www-data est un accès en lecture seule. Sinon, ça fait un méga trou de sécurité.
De plus, l’intérêt est certainement que l'utilisateur "normal" puisse y écrire : ce ne sera plus le cas si on change le propriétaire.
NB : Sur mes différents PC, les répertoires et fichiers appartiennent à root:root et ça fonctionne.


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#11 Le 12/07/2017, à 16:46

jplemoine

Re : Apache -- Erreur 500

pour le ftp, il faut dédier un répertoire qui lui sera en lecture-écriture (mais lui seul) par www-data.
le ftp (comme le ssh) ne doit jamais être possible pour root (sauf pour les initiés car ils mettent en place des sécurités adéquates).


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#12 Le 12/07/2017, à 17:56

SHHP

Re : Apache -- Erreur 500

Merci pour vos réponses, je vais donc modifier le

<Directory /home/ubuntu/www/>

en

<Directory /var/www/>

Et

sudo chown -R www-data:www-data /home/ubuntu/www

Mais quand j'essaye d'éditer un fhcier dans mon ftp, une autre erreur apparaît:

Commande :	PASV
Réponse :	227 Entering Passive Mode.
Commande :	RETR config.php
Réponse :	550 Failed to open file.
Erreur :	Erreur critique lors du transfert du fichier

Dernière modification par SHHP (Le 12/07/2017, à 18:02)

Hors ligne

#13 Le 12/07/2017, à 18:12

HPIR40

Re : Apache -- Erreur 500

je n'avais poas fait attention que c'était pour du FTP hmm

Hors ligne

#14 Le 12/07/2017, à 18:45

SHHP

Re : Apache -- Erreur 500

Bon, retour à la case départ, vu que j'ai installé phpmyadmin et qu'il m'interdisait l'accès sur le site, j'ai fait

sudo chown -R www-data:www-data /etc/phpmyadmin

mais maintenant, c'est erreur 403 dans
babbofan.fr/phpmyadmin et babbofan.fr (les fichiers normaux)

Dernière modification par SHHP (Le 12/07/2017, à 19:41)

Hors ligne

#15 Le 13/07/2017, à 08:30

bruno

Re : Apache -- Erreur 500

Aïe !
Il ne fallait surtout pas changer les droits sur /etc/phpmyadmin ! Quelle drôle d'idée…
Pour remettre les choses en place :

sudo chown -R root:root /etc/phpmyadmin
sudo chgrp www-data /etc/phpmyadmin/config-db.php /etc/phpmyadmin/htpasswd.setup

Ensuite il faut nous donner ta configuration, celle du vhost qui correspond à babbofan.fr.

Hors ligne

#16 Le 13/07/2017, à 08:49

SHHP

Re : Apache -- Erreur 500

Voici mon fichier /etc/host

127.0.0.1       localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost   ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.1.1       serveur-1.localdomain   serveur-1
bruno a écrit :

Aïe !
Il ne fallait surtout pas changer les droits sur /etc/phpmyadmin ! Quelle drôle d'idée…
Pour remettre les choses en place :

sudo chown -R root:root /etc/phpmyadmin
sudo chgrp www-data /etc/phpmyadmin/config-db.php /etc/phpmyadmin/htpasswd.setup
Ensuite il faut nous donner ta configuration, celle du vhost qui correspond à babbofan.fr.

J'ai fais les commandes, rien n'a changé

Dernière modification par SHHP (Le 13/07/2017, à 08:51)

Hors ligne

#17 Le 13/07/2017, à 09:02

bruno

Re : Apache -- Erreur 500

La configuration de ton vhost, c'est à dire VirtualHost ou hôte virtuel, celle qui doit se trouver dans /etc/apache2/sites-enabled/

et aussi pour voir les droits, le retour de :

ls -la /home/ubuntu/www

Hors ligne

#18 Le 13/07/2017, à 09:13

SHHP

Re : Apache -- Erreur 500

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin cpthenri2004@gmail.com
        DocumentRoot /home/ubuntu/www/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

pour le ls ça donne ça:

total 236
drwxrwxr-x 7 www-data www-data  4096 Jul 11 17:38 .
drwxr-xr-x 7 ubuntu   ubuntu    4096 Jul 12 16:57 ..
drwxrwxr-x 4 www-data www-data  4096 Jul 11 17:37 admin
-rwxrwxr-x 1 www-data www-data  1743 Jul 11 17:37 article.php
drwxrwxr-x 3 www-data www-data  4096 Jul 11 17:37 assets
-rwxrwxr-x 1 www-data www-data  4439 Jul 11 17:37 contact.php
-rwxrwxr-x 1 www-data www-data 88641 Jul 11 17:37 db.sql
drwxrwxr-x 3 www-data www-data  4096 Jul 11 17:37 dev
-rwxrwxr-x 1 www-data www-data   828 Jul 11 17:37 events.php
-rwxrwxr-x 1 www-data www-data  4710 Jul 11 17:37 favicon.ico
-rw------- 1 www-data www-data   312 Jul 11 17:37 .htaccess
drwxrwxr-x 2 www-data www-data  4096 Jul 11 17:38 includes
-rwxrwxr-x 1 www-data www-data  6188 Jul 11 17:37 index.php
-rwxrwxr-x 1 www-data www-data  6092 Jul 11 17:37 liste.php
-rwxrwxr-x 1 www-data www-data  2402 Jul 11 17:37 maintenance.php
-rwxrwxr-x 1 www-data www-data  5074 Jul 11 17:37 news.php
-rwxrwxr-x 1 www-data www-data  5528 Jul 11 17:37 postdedi.php
-rwxrwxr-x 1 www-data www-data  3782 Jul 11 17:37 secu.php
-rwxrwxr-x 1 www-data www-data  7559 Jul 11 17:37 settings.php
-rwxrwxr-x 1 www-data www-data   690 Jul 11 17:37 social.php
-rwxrwxr-x 1 www-data www-data  5929 Jul 11 17:37 staff.php
drwxrwxr-x 4 www-data www-data  4096 Jul 11 17:38 themes
-rwxrwxr-x 1 www-data www-data 32737 Jul 11 17:37 u986074820_h (1).sql

Dernière modification par SHHP (Le 13/07/2017, à 09:14)

Hors ligne

#19 Le 13/07/2017, à 09:56

bruno

Re : Apache -- Erreur 500

Ok.
Dans ton fichier de VirtualHost il faut rajouter ceci pour autoriser l'accès à tous :

…

        ServerAdmin cpthenri2004@gmail.com
        DocumentRoot /home/ubuntu/www/

       <Directory /home/ubuntu/www/>
            Options -Indexes +FollowSymLinks
            AllowOverride all
            Require all granted
       </Directory>

…

Puis recharger la configuration d'Apache :

sudo service apache2 reload

Et le site devrait fonctionner.



Les droits sur tes fichiers sont trop élevés (droits d'exécution), on peut corriger ainsi :

sudo chmod -R 664 /home/ubuntu/www
sudo chmod -R a+X /home/ubuntu/www

La première commande attribue les droits en lecture et écriture uniquement pour le propriétaire et pour le groupe, les droits en lecture seulement pour le reste du monde
La seconde remet le droit d'entrée pur tout le monde dans les dossier (avec le X majuscule, cf man chmod) .

Et finalement tu pourra mettre 'ubuntu' comme propriétaire et te connecter en FTP avec cet utilisateur :

sudo chown -R ubuntu:www-data /home/ubuntu/www

Dernière modification par bruno (Le 13/07/2017, à 09:56)

Hors ligne

#20 Le 13/07/2017, à 10:22

SHHP

Re : Apache -- Erreur 500

J'ai mis toute les commandes. On en est maintenant à une erreur 500

Hors ligne

#21 Le 13/07/2017, à 10:24

bruno

Re : Apache -- Erreur 500

Il faut regarder les logs. L'erreur 500 peut être du à un script php du site qui bloque.
Il faut aussi regarder le contenu du fichier .htaccess qui est à la racine du site.

Hors ligne

#22 Le 13/07/2017, à 10:30

SHHP

Re : Apache -- Erreur 500

Ok, pas de fichier .htaccess et voici les logs:

[Thu Jul 13 06:25:02.514588 2017] [mpm_prefork:notice] [pid 23941] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Jul 13 06:25:02.514629 2017] [core:notice] [pid 23941] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 13 07:09:22.431940 2017] [authz_core:error] [pid 18185] [client 139.162.114.70:51206] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:17:22.043142 2017] [authz_core:error] [pid 18188] [client 103.204.179.86:3876] AH01630: client denied by server configuration: /home/ubuntu/www/, referer: http://217.182.81.232:80
[Thu Jul 13 07:18:25.846032 2017] [authz_core:error] [pid 18187] [client 82.251.241.242:45780] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:23:51.055594 2017] [authz_core:error] [pid 18186] [client 109.89.196.30:53950] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:00.417302 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:00.886001 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:01.040015 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:01.202023 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:01.344200 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:01.496174 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:02.238421 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:02.324080 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:02.640624 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:02.864634 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:03.038125 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:04.288089 2017] [authz_core:error] [pid 18185] [client 109.89.196.30:54066] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:26:09.896972 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54068] AH01630: client denied by server configuration: /home/ubuntu/www/phpmyadmin
[Thu Jul 13 07:45:39.087770 2017] [authz_core:error] [pid 18187] [client 5.48.149.125:24894] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:45:39.340627 2017] [authz_core:error] [pid 18187] [client 5.48.149.125:24894] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 07:50:16.399954 2017] [authz_core:error] [pid 18186] [client 109.89.196.30:54450] AH01630: client denied by server configuration: /home/ubuntu/www/phpmyadmin
[Thu Jul 13 07:50:17.052768 2017] [authz_core:error] [pid 18186] [client 109.89.196.30:54450] AH01630: client denied by server configuration: /home/ubuntu/www/phpmyadmin
[Thu Jul 13 07:50:20.898220 2017] [authz_core:error] [pid 18186] [client 109.89.196.30:54450] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:47.732446 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54476] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:47.909197 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54476] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:48.085751 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54476] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:48.245578 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54476] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:48.427107 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54476] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:55.507154 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54480] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:56.997088 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54480] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 07:51:58.215067 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54480] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 07:51:58.277124 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54480] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 07:52:03.652401 2017] [authz_core:error] [pid 18194] [client 109.89.196.30:54484] AH01630: client denied by server configuration: /home/ubuntu/www/phpmyadmin
[Thu Jul 13 07:52:03.819153 2017] [authz_core:error] [pid 18194] [client 109.89.196.30:54484] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/php$
[Thu Jul 13 08:06:18.645406 2017] [authz_core:error] [pid 18432] [client 41.251.154.208:50863] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:06:19.064778 2017] [authz_core:error] [pid 18432] [client 41.251.154.208:50863] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 08:18:42.806098 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54600] AH01630: client denied by server configuration: /home/ubuntu/www/phpmyadmin
[Thu Jul 13 08:18:42.924782 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54600] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/php$
[Thu Jul 13 08:18:46.096856 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54600] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:18:46.362808 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54600] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 08:18:51.903761 2017] [authz_core:error] [pid 18194] [client 109.89.196.30:54606] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:30:56.479109 2017] [authz_core:error] [pid 18188] [client 109.89.196.30:54644] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:40:29.692720 2017] [authz_core:error] [pid 18846] [client 90.90.33.165:48612] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:41:32.493103 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54752] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:41:33.954346 2017] [authz_core:error] [pid 18432] [client 109.89.196.30:54752] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:45:51.020666 2017] [authz_core:error] [pid 18186] [client 41.251.154.208:51080] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:45:52.064756 2017] [authz_core:error] [pid 18186] [client 41.251.154.208:51080] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 08:47:11.801390 2017] [authz_core:error] [pid 18846] [client 41.251.154.208:51143] AH01630: client denied by server configuration: /home/ubuntu/www/
[Thu Jul 13 08:47:11.918959 2017] [authz_core:error] [pid 18846] [client 41.251.154.208:51143] AH01630: client denied by server configuration: /home/ubuntu/www/favicon.ico, referer: http://babbofan.fr/
[Thu Jul 13 09:20:54.994316 2017] [mpm_prefork:notice] [pid 23941] AH00171: Graceful restart requested, doing restart
[Thu Jul 13 09:20:55.100387 2017] [mpm_prefork:notice] [pid 23941] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Jul 13 09:20:55.100418 2017] [core:notice] [pid 23941] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 13 09:21:44.685898 2017] [core:alert] [pid 19104] [client 109.89.196.30:55430] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:21:45.311798 2017] [core:alert] [pid 19105] [client 109.89.196.30:55432] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:21:47.543511 2017] [core:alert] [pid 19103] [client 109.89.196.30:55434] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:22:05.726149 2017] [mpm_prefork:notice] [pid 23941] AH00171: Graceful restart requested, doing restart
[Thu Jul 13 09:20:55.100387 2017] [mpm_prefork:notice] [pid 23941] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Jul 13 09:20:55.100418 2017] [core:notice] [pid 23941] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 13 09:21:44.685898 2017] [core:alert] [pid 19104] [client 109.89.196.30:55430] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:21:45.311798 2017] [core:alert] [pid 19105] [client 109.89.196.30:55432] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:21:47.543511 2017] [core:alert] [pid 19103] [client 109.89.196.30:55434] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:22:05.726149 2017] [mpm_prefork:notice] [pid 23941] AH00171: Graceful restart requested, doing restart
[Thu Jul 13 09:22:05.797993 2017] [mpm_prefork:notice] [pid 23941] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Jul 13 09:22:05.798013 2017] [core:notice] [pid 23941] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 13 09:22:08.267984 2017] [core:alert] [pid 19139] [client 109.89.196.30:55448] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:22:08.841940 2017] [core:alert] [pid 19140] [client 109.89.196.30:55446] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$
[Thu Jul 13 09:22:09.106309 2017] [core:alert] [pid 19141] [client 109.89.196.30:55450] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$

Hors ligne

#23 Le 13/07/2017, à 11:14

bruno

Re : Apache -- Erreur 500

Il y a bien un fichier .htaccess et c'est même lui qui provoque une erreur :

[Thu Jul 13 09:22:09.106309 2017] [core:alert] [pid 19141] [client 109.89.196.30:55450] /home/ubuntu/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included$

Indique-nous le contenu de /home/ubuntu/www/.htaccess

Et au vu de l'erreur il serait peut-être utile d’activer le mod_rewrite d'Apache :

sudo a2enmod rewrite

et relancer le service apache2.

Hors ligne

#24 Le 13/07/2017, à 11:20

SHHP

Re : Apache -- Erreur 500

Bon, voici le fichier .htaccess qui n'était pas visible avec le ls.

# DO NOT REMOVE THIS LINE AND THE LINES BELOW HOTLINKID:eTyXatezyV
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?npixelfan.esy.es/.*$      [NC]
RewriteRule .*\.(.*)$ http://google.com [R,NC]
# DO NOT REMOVE THIS LINE AND THE LINES ABOVE eTyXatezyV:HOTLINKID

Je devrait peut-être changer le npixelfan.esy.es en babbofan.fr ?

Hors ligne

#25 Le 13/07/2017, à 11:39

bruno

Re : Apache -- Erreur 500

Tu as activé le mod rewrite ? Est-ce que cela a fonctionné ?

Ton .htaccess, tu dois bien savoir d'où il vient et pourquoi il est là… Si tu ne le sais pas supprime-le.

Dernière modification par bruno (Le 13/07/2017, à 11:40)

Hors ligne