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 05/11/2015, à 12:09

axel338

[RESOLU] Multi sites

Bonjour,

Que je vous explique,

Il y a quelques déjà j'ai monté un serveur apache sous débian 8 (jessie) et j'ai installer plusieurs site web à partir de la même directory par défaut

Et donc histoire de bien donné des URL simple à mes utilisateurs j'ai créé des sites en fonctions de la directory

par exemple
site1 à son fichier /etc/apache2/sites-available/site1.conf avec comme DocumentRoot "/var/www/html/site1" et j'ai défini dans le DNS un hote(A) site1 avec comme adresse l'adresse IP du serveur
site2 à son fichier /etc/apache2/sites-available/site2.conf avec comme DocumentRoot "/var/www/html/site2" et j'ai défini dans le DNS un hote(A) site2 avec comme adresse l'adresse IP du serveur
...

Donc en principe quand je vais sur un navigateur et que je tape comme URL http://site1.example.com je doit tomber sur l'index du site1 mais là non il me met l'index du site http://example.com

quelqu'un pourrais m'aider SVP car là je ne vois pas d'ou viens mon problème.

Dernière modification par axel338 (Le 09/11/2015, à 14:24)

Hors ligne

#2 Le 05/11/2015, à 12:22

mazarini

Re : [RESOLU] Multi sites

Surement une faute de frappe, essayes la commande "apache2ctl  -D DUMP_VHOSTS" :

root@web:~# apache2ctl  -D DUMP_VHOSTS
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server web.xxxx.link (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost web.xxxx.link (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost old.xxxxxxx.ovh (/etc/apache2/sites-enabled/100-old-xxxxxxx-ovh.conf:1)
         port 80 namevhost xxxxxxx.ovh (/etc/apache2/sites-enabled/110-xxxxxxx-ovh.conf:1)
         port 80 namevhost new.xxxxxxx.ovh (/etc/apache2/sites-enabled/120-new-xxxxxxx-ovh.conf:1)
         port 80 namevhost stat.xxxxxxx.ovh (/etc/apache2/sites-enabled/300-stat-xxxxxxxx-ovh.conf:1)
root@web:~#

S'il existait une école de la politique, les locaux devraient être édifiés rue de la Santé. Les élèves pourraient s'habituer. (Pierre Dac)

Hors ligne

#3 Le 05/11/2015, à 14:04

axel338

Re : [RESOLU] Multi sites

Alors voila se que j'obtien quand je fait la commande apache2ctl  -D DUMP_VHOSTS

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost site1.example.com (/etc/apache2/sites-enabled/site1.conf:1)
         port 80 namevhost site2.example.com (/etc/apache2/sites-enabled/site2.conf:1)

Hors ligne

#4 Le 05/11/2015, à 17:07

Filador

Re : [RESOLU] Multi sites

Bonsoir axel338,

Dans ton fichier /etc/apache2/sites-available/site1.conf

As-tu bien renseigné le ServerName et le ServerAlias ?

Hors ligne

#5 Le 05/11/2015, à 17:15

axel338

Re : [RESOLU] Multi sites

Bonsoir Filador

Dans mon fichier site1.conf j'ai bien mis ServerName site1.example.com
mais pas ServerAlias car la je ne sais pas quoi mettre

Hors ligne

#6 Le 05/11/2015, à 20:32

Filador

Re : [RESOLU] Multi sites

Essaye donc avec :

ServerAlias site1.example.com

Et recharge le service. smile

Hors ligne

#7 Le 06/11/2015, à 09:08

mazarini

Re : [RESOLU] Multi sites

axel338 a écrit :

Alors voila se que j'obtien quand je fait la commande apache2ctl  -D DUMP_VHOSTS

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive  globally to suppress this message

A priori, il faut mettre localhost.localdomain en premier sur la ligne 127.0.0.1 dans le fichier /etc/hosts.

127.0.0.1       localhost.localdomain localhost

Mais ce n'est pas une erreur gênante, juste un warning.

axel338 a écrit :
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost site1.example.com (/etc/apache2/sites-enabled/site1.conf:1)
         port 80 namevhost site2.example.com (/etc/apache2/sites-enabled/site2.conf:1)

On voit que tu as bien défini le lien entre les vhost et les noms. Il te reste à vérifier le documentroot dans site1.conf ou site2.conf. Si un nom ne pointe pas vers le bon site, c'est uniquement que le documentroot n'est pas bon. Au pire, tu peux faire une page index.html sur chaque site avec juste le nom du site et tester.

Remarque, le serverAlias n'est utile que si tu veux utiliser plusieurs noms pour le même site. Comme certains qui font pointer www.exemple.com et exemple.com sur le même site.


S'il existait une école de la politique, les locaux devraient être édifiés rue de la Santé. Les élèves pourraient s'habituer. (Pierre Dac)

Hors ligne

#8 Le 06/11/2015, à 17:22

axel338

Re : [RESOLU] Multi sites

Bonjour,

Désoler pour mon temps de réponse. Et surtout je tenais a vous remercier pour votre aide

Alors j'ai bien vérifier mon /etc/hosts et j'ai mis

127.0.0.1       localhost.localdomain   localhost
127.0.1.1       srv-web srv-web.example.com
192.168.2.79    srv-web srv-web.example.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Ensuite voici mon site1.conf

<VirtualHost site1.example.com>
ServerName site1.example.com
DocumentRoot "/var/www/html/site1"
<Directory "/var/www/html/site1">
allow from all
Options None
Require all granted
</Directory>
</VirtualHost>

et donc quand je fait un service apache2 reload voici se qu'il me met
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.

et la commande systemctl status apache2.service met sa:

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: active (exited) (Result: exit-code) since jeu. 2015-11-05 17:39:19 CET; 23h ago
  Process: 22365 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE)

nov. 06 17:14:38 srv-web systemd[1]: apache2.service: control process exited, code=exited status=1
nov. 06 17:14:38 srv-web systemd[1]: Reload failed for LSB: Apache2 web server.
nov. 06 17:15:02 srv-web apache2[22365]: Reloading web server: apache2 failed!
nov. 06 17:15:02 srv-web apache2[22365]: The apache2 configtest failed. Not doing anything. ... (warning).
nov. 06 17:15:02 srv-web apache2[22365]: Output of config test was:
nov. 06 17:15:02 srv-web apache2[22365]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Could not open con...rectory
nov. 06 17:15:02 srv-web apache2[22365]: Action 'configtest' failed.
nov. 06 17:15:02 srv-web apache2[22365]: The Apache error log may have more information.
nov. 06 17:15:02 srv-web systemd[1]: apache2.service: control process exited, code=exited status=1
nov. 06 17:15:02 srv-web systemd[1]: Reload failed for LSB: Apache2 web server.
Hint: Some lines were ellipsized, use -l to show in full.

et La commande journalctl -xn fait sa:

-- Logs begin at jeu. 2015-11-05 17:24:55 CET, end at ven. 2015-11-06 17:15:02 CET. --
nov. 06 17:15:01 srv-web CRON[22357]: (root) CMD (   /etc/init.d/apache2 force-reload)
nov. 06 17:15:02 srv-web apache2[22365]: Reloading web server: apache2 failed!
nov. 06 17:15:02 srv-web apache2[22365]: The apache2 configtest failed. Not doing anything. ... (warning).
nov. 06 17:15:02 srv-web apache2[22365]: Output of config test was:
nov. 06 17:15:02 srv-web apache2[22365]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Could not open configuration
nov. 06 17:15:02 srv-web apache2[22365]: Action 'configtest' failed.
nov. 06 17:15:02 srv-web apache2[22365]: The Apache error log may have more information.
nov. 06 17:15:02 srv-web systemd[1]: apache2.service: control process exited, code=exited status=1
nov. 06 17:15:02 srv-web systemd[1]: Reload failed for LSB: Apache2 web server.
-- Subject: L'unité (unit) apache2.service a terminé de recharger configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) apache2.service a terminé de recharger configuration,
-- avec le résultat failed.
nov. 06 17:15:02 srv-web CRON[22356]: pam_unix(cron:session): session closed for user root

Qu'en pensez vous?

Hors ligne

#9 Le 07/11/2015, à 08:04

bruno

Re : [RESOLU] Multi sites

Bonjour,

il faut corriger ceci dans tes hôtes virtuels :

<VirtualHost site1.example.com>

Voir ici : https://httpd.apache.org/docs/2.2/mod/c … irtualhost

<VirtualHost *:80>

Ensuite, le retour de la commande systemctl t'indique clairement qu'il y a une erreur de syntaxe à a ligne 255 du fichier apache2.conf. À corriger aussi, mais normalement tu n'aurais pas du modifier ce fichier.

Hors ligne

#10 Le 07/11/2015, à 14:20

axel338

Re : [RESOLU] Multi sites

Voici mon fichier /etc/apache2/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 debug

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

Je n'ai rien toucher depuis son installation et j'ai changer le virtual host de mon fichier site1.example.com
et quand je fait un /etc/ini.d/apache2 start puis /etc/ini.d/apache2 reload voici se qu'il me met maintenant

-- Logs begin at jeu. 2015-11-05 17:24:55 CET, end at sam. 2015-11-07 14:17:40 CET. --
nov. 07 14:15:01 srv-web systemd[1]: apache2.service: control process exited, code=exited status=1
nov. 07 14:15:01 srv-web systemd[1]: Reload failed for LSB: Apache2 web server.
-- Subject: L'unité (unit) apache2.service a terminé de recharger configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) apache2.service a terminé de recharger configuration,
-- avec le résultat failed.
nov. 07 14:15:01 srv-web CRON[2370]: pam_unix(cron:session): session closed for user root
nov. 07 14:17:01 srv-web CRON[2422]: pam_unix(cron:session): session opened for user root by (uid=0)
nov. 07 14:17:01 srv-web CRON[2423]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
nov. 07 14:17:01 srv-web CRON[2422]: pam_unix(cron:session): session closed for user root
nov. 07 14:17:40 srv-web apache2[2452]: Reloading web server: apache2 failed!
nov. 07 14:17:40 srv-web apache2[2452]: Apache2 is not running ... (warning).
nov. 07 14:17:40 srv-web systemd[1]: apache2.service: control process exited, code=exited status=1
nov. 07 14:17:40 srv-web systemd[1]: Reload failed for LSB: Apache2 web server.
-- Subject: L'unité (unit) apache2.service a terminé de recharger configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) apache2.service a terminé de recharger configuration,
-- avec le résultat failed.

J'ai l'impression que le service apache2 ne veux pas rester allumer mais là je ne comprend pas pourquoi

Dernière modification par axel338 (Le 07/11/2015, à 14:22)

Hors ligne

#11 Le 07/11/2015, à 15:29

bruno

Re : [RESOLU] Multi sites

Tu dois encore avoir une erreir dans les fichiers de configuration, Fais une vérification avec :

sudo apache2ctl -t

Cela devrait t'indiquer où  se situent les erreurs. Tu peux aussi regarder les logs (/var/apache2/error.log)

Hors ligne

#12 Le 07/11/2015, à 15:41

axel338

Re : [RESOLU] Multi sites

voici le résultat de apache2ctl -l

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

et rien n’apparaît dans /var/log/apache2/error.log

Hors ligne

#13 Le 07/11/2015, à 16:15

bruno

Re : [RESOLU] Multi sites

Ce n'est pas une erreur bloquante, donc apache2 devrait redémarrer sans problème…
Il faut voir le retour de :

sudo service apache2 restart

Hors ligne

#14 Le 07/11/2015, à 16:19

axel338

Re : [RESOLU] Multi sites

Ben cela fait la même chose c'est a dire quand je met sur mon navigateur http://site1.example.com il me met la page par défaut de mon serveur

Hors ligne

#15 Le 08/11/2015, à 08:32

bruno

Re : [RESOLU] Multi sites

Là je ne comprends plus…
Tes retours de commandes indiquent qu'Apache ne démarre pas :

-- L'unité (unit) apache2.service a terminé de recharger configuration,
-- avec le résultat failed.

Je ne vois donc pas comment ton navigateur pourrait afficher quoi que ce soit.

Hors ligne

#16 Le 08/11/2015, à 12:59

adgenodux

Re : [RESOLU] Multi sites

peut-être un

ps aux | grep apache2

... pour voir les processus ?

Hors ligne

#17 Le 08/11/2015, à 13:35

adgenodux

Re : [RESOLU] Multi sites

mazarini a écrit :

A priori, il faut mettre localhost.localdomain en premier sur la ligne 127.0.0.1 dans le fichier /etc/hosts.

127.0.0.1       localhost.localdomain localhost

Mais ce n'est pas une erreur gênante, juste un warning.

J'ai aussi un peu de mal avec ces notions alors je mélange peut-être certaines choses mais ne faut-il pas aussi déclarer les différents sites sous la forme suivante ?

127.0.0.1       localhost.localdomain localhost
127.0.0.1       site1.example.com
127.0.0.1       site2.example.com

car là on voit

127.0.0.1       localhost.localdomain   localhost
127.0.1.1       srv-web srv-web.example.com
192.168.2.79    srv-web srv-web.example.com

Donc si srv-web est site1.example.com, quel est le site 2 ?

Et quel est l'usage de la ligne 192.168... ?

Selon ma structure à moi, ceci me laisse un peu perplexe je vous l'avoue car je n'utilise pas de serveur dns pour héberger plusieurs sites... :-/

Dernière modification par adgenodux (Le 08/11/2015, à 13:38)

Hors ligne

#18 Le 09/11/2015, à 09:03

axel338

Re : [RESOLU] Multi sites

adgenodux a écrit :

peut-être un

ps aux | grep apache2

... pour voir les processus ?

Rien au processe ne tourne

Maintenant ma question peu etre stupide mais il y a un moyen de tout tremettre par défaut? genre une commande dpkg-reconfigure apapche2?

Histoire que nous repartions a partir de bonne base.

Hors ligne

#19 Le 09/11/2015, à 09:38

mazarini

Re : [RESOLU] Multi sites

127.0.0.1       localhost.localdomain   localhost
127.0.1.1       srv-web srv-web.example.com
192.168.2.79    srv-web srv-web.example.com

Ca ne me semble pas bon d'avoir 2 adresses pour un nom
Il me semble mieux :

127.0.0.1       localhost.localdomain   localhost
192.168.2.79    srv-web.example.com srv-web

S'il existait une école de la politique, les locaux devraient être édifiés rue de la Santé. Les élèves pourraient s'habituer. (Pierre Dac)

Hors ligne

#20 Le 09/11/2015, à 10:03

bruno

Re : [RESOLU] Multi sites

Le problème reste incompréhensible en l'état :

- Apache n'est pas lancé (voir les retours précédent) mais ton navigateur affiche quand me quelque chose ! C'est impossible, à moins qu'il n'y ait deux serveurs différents.

- Apache refuse de se lancer ou de recharger sa configuration mais tu n'as rien dans error.log ! C'est impossible, car il devrait y avoir au moins une ligne indiquant l'échec du lancement d'Apache et son motif. À la limite cela pourrait arriver si un autre serveur est déjà en écoute sur le port 80.

Pour les services en écoute en TCP voir le retour de :

netstat -tnlp

et/ou pour voir les services actifs/inactifs :

service --status-all 

pour vérifier les correspondances nom de domaine IP  :

host example.com
host site1.example.com
host site2.example.com

et à quoi correspond srv-web.example.com ?

Hors ligne

#21 Le 09/11/2015, à 10:18

axel338

Re : [RESOLU] Multi sites

Bonjour

bruno a écrit :

Le problème reste incompréhensible en l'état :

- Apache n'est pas lancé (voir les retours précédent) mais ton navigateur affiche quand me quelque chose ! C'est impossible, à moins qu'il n'y ait deux serveurs différents.

- Apache refuse de se lancer ou de recharger sa configuration mais tu n'as rien dans error.log ! C'est impossible, car il devrait y avoir au moins une ligne indiquant l'échec du lancement d'Apache et son motif. À la limite cela pourrait arriver si un autre serveur est déjà en écoute sur le port 80.

Pour les services en écoute en TCP voir le retour de :

netstat -tnlp

et/ou pour voir les services actifs/inactifs :

service --status-all 

pour vérifier les correspondances nom de domaine IP  :

host example.com
host site1.example.com
host site2.example.com

et à quoi correspond srv-web.example.com ?

netsttat -tnlp

Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale          Adresse distante        Etat        PID/Program name
tcp        0      0 0.0.0.0:40268           0.0.0.0:*               LISTEN      538/rpc.statd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      523/rpcbind
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      1222/perl
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      690/lighttpd
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      769/proftpd: (accep
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      567/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1572/exim4
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1165/mysqld
tcp6       0      0 :::111                  :::*                    LISTEN      523/rpcbind
tcp6       0      0 :::80                   :::*                    LISTEN      690/lighttpd
tcp6       0      0 :::22                   :::*                    LISTEN      567/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1572/exim4
tcp6       0      0 :::35557                :::*                    LISTEN      538/rpc.statd

service --status-all

 [ + ]  acpid
 [ - ]  alsa-utils
 [ - ]  anacron
 [ - ]  apache2
 [ + ]  atd
 [ + ]  avahi-daemon
 [ - ]  bluetooth
 [ - ]  bootlogs
 [ - ]  bootmisc.sh
 [ - ]  checkfs.sh
 [ - ]  checkroot-bootclean.sh
 [ - ]  checkroot.sh
 [ + ]  console-setup
 [ + ]  cron
 [ + ]  dbus
 [ + ]  exim4
 [ + ]  fail2ban
 [ + ]  gdm3
 [ - ]  gdomap
 [ - ]  hostname.sh
 [ - ]  hwclock.sh
 [ + ]  kbd
 [ + ]  keyboard-setup
 [ - ]  killprocs
 [ + ]  kmod
 [ + ]  lighttpd
 [ + ]  minissdpd
 [ - ]  motd
 [ - ]  mountall-bootclean.sh
 [ - ]  mountall.sh
 [ - ]  mountdevsubfs.sh
 [ - ]  mountkernfs.sh
 [ - ]  mountnfs-bootclean.sh
 [ - ]  mountnfs.sh
 [ + ]  mysql
 [ + ]  network-manager
 [ + ]  networking
 [ + ]  nfs-common
 [ + ]  ntp
 [ + ]  openbsd-inetd
 [ - ]  pppd-dns
 [ + ]  procps
 [ + ]  proftpd
 [ + ]  rc.local
 [ - ]  rmnologin
 [ + ]  rpcbind
 [ - ]  rsync
 [ + ]  rsyslog
 [ + ]  saned
 [ - ]  sendsigs
 [ + ]  speech-dispatcher
 [ + ]  ssh
 [ - ]  sudo
 [ + ]  udev
 [ + ]  udev-finish
 [ - ]  umountfs
 [ - ]  umountnfs.sh
 [ - ]  umountroot
 [ + ]  urandom
 [ + ]  vmware-tools
 [ + ]  webmin
 [ - ]  x11-common

host example.com

Host example.com not found: 3(NXDOMAIN)

host site1.example.com

site1.example.com has address 192.168.2.79

host site2.example.com

site2.example.com has address 192.168.2.79
mazarini  a écrit :
127.0.0.1       localhost.localdomain   localhost
127.0.1.1       srv-web srv-web.example.com
192.168.2.79    srv-web srv-web.example.com

Ca ne me semble pas bon d'avoir 2 adresses pour un nom
Il me semble mieux :

127.0.0.1       localhost.localdomain   localhost
192.168.2.79    srv-web.example.com srv-web

Voici mon fichier /etc/hosts

127.0.0.1       localhost       localhost.domainlocal
127.0.0.1       site1     site1.example.com
127.0.0.1       site2    site2.example.com
192.168.2.79    srv-web srv-web.example.com

Hors ligne

#22 Le 09/11/2015, à 10:43

bruno

Re : [RESOLU] Multi sites

Bingo !

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      690/lighttpd

Il y a déjà le serveur web lighthttpd qui est en écoute sur le port 80. Apache ne peut donc pas fonctionner sur le même port.

À toi de voir si veux utiliser ligthhttpd ou Apache et donc de désinstaller l'un ou l'autre. Tu peux éventuellement utiliser les deux en me temps mais pas sur le même port.

Hors ligne

#23 Le 09/11/2015, à 10:58

axel338

Re : [RESOLU] Multi sites

bruno a écrit :

Bingo !

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      690/lighttpd

Il y a déjà le serveur web lighthttpd qui est en écoute sur le port 80. Apache ne peut donc pas fonctionner sur le même port.

À toi de voir si veux utiliser ligthhttpd ou Apache et donc de désinstaller l'un ou l'autre. Tu peux éventuellement utiliser les deux en me temps mais pas sur le même port.

Effectivement je ne l'avais pas vu merci

Donc j'ai désinstaller lighttp et je me suis dit bonb oki tout devrais fonctionner maintenant et quand je lance apache voici se qu'il me donne

Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.

alors je fait un journalctl -xn et sa donne sa

-- Logs begin at lun. 2015-11-09 10:03:00 CET, end at lun. 2015-11-09 10:51:37 CET. --
nov. 09 10:51:19 srv-web systemd[1]: Unit apache2.service entered failed state.
nov. 09 10:51:37 srv-web apache2[4593]: Starting web server: apache2 failed!
nov. 09 10:51:37 srv-web apache2[4593]: The apache2 configtest failed. ... (warning).
nov. 09 10:51:37 srv-web apache2[4593]: Output of config test was:
nov. 09 10:51:37 srv-web apache2[4593]: AH00534: apache2: Configuration error: No MPM loaded.
nov. 09 10:51:37 srv-web apache2[4593]: Action 'configtest' failed.
nov. 09 10:51:37 bfa-web apache2[4593]: The Apache error log may have more information.
nov. 09 10:51:37 bfa-web systemd[1]: apache2.service: control process exited, code=exited status=1
nov. 09 10:51:37 bfa-web systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: L'unité (unit) apache2.service a échoué
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) apache2.service a échoué, avec le résultat failed.
nov. 09 10:51:37 srv-web systemd[1]: Unit apache2.service entered failed state.

Hors ligne

#24 Le 09/11/2015, à 11:11

bruno

Re : [RESOLU] Multi sites

L'erreur est indiquée :

AH00534: apache2: Configuration error: No MPM loaded.

Pas de MPM chargé, Apache ne peut donc pas fonctionner.
C'est du à une installation incomplète ou à des bidouillages successifs…

Tu peux essayer de remettre le MPM par défaut (prefork) avec la commande :

sudo a2enmod mpm_prefork

Dernière modification par bruno (Le 09/11/2015, à 11:11)

Hors ligne

#25 Le 09/11/2015, à 11:30

axel338

Re : [RESOLU] Multi sites

Brubno a écrit :

L'erreur est indiquée :

AH00534: apache2: Configuration error: No MPM loaded

.
Pas de MPM chargé, Apache ne peut donc pas fonctionner.
C'est du à une installation incomplète ou à des bidouillages successifs…

Tu peux essayer de remettre le MPM par défaut (prefork) avec la commande :

sudo a2enmod mpm_prefork

Dernière modification par bruno (Aujourd'hui à 11:11)

Alors quand je fais a2enmod mpm_prefork il me met

Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:

Donc je fais
a2dismod mpm_event mpm_worker et il me met

Module mpm_event already disabled
Module mpm_worker already disabled

Hors ligne