#1 Le 26/07/2016, à 08:37
- Andromedae93
Création de vhosts sous apache2 et ubuntu
Bonjour à toutes et à tous,
Je me permets de poster un message sur le forum car je sollicite votre aide pour m'aider à résoudre mon problème de hosts virtuels.
J'ai un serveur ayant l'IP 172.X.X.61 sur lequel est installé 2 appli web : dolibarr et prestashop.
J'aimerais pouvoir utiliser les deux en même temps et donc associer à chaque appli un serveur virtuel.
J'ai donc effectué la modification suivante dans /etc/hosts :
127.0.0.1 localhost
172.30.10.61 dolibarrmoriba.com
172.30.10.62 prestashopmoriba.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Puis, j'ai créé 2 fichiers dans /etc/apache2/sites-available/ portant les noms dolibarr.conf et prestashop.conf
dolibarr.conf :
<VirtualHost 172.30.10.61:80>
ServerAdmin webserver@localhost
DocumentRoot /var/www/dolibarr/htdocs/
ServerName dolibarrmoriba.com
ServerAlias www.dolibarrmoriba.com
<Directory /var/www/dolibarr/htdocs>
Options FollowSymLinks
AllowOverride All
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/errordolibarr.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/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
</Directory>
# 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".
# 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}/errordolibarr.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
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</VirtualHost>
et prestashop.conf :
<VirtualHost 172.30.10.62:80>
ServerAdmin webserver@localhost
DocumentRoot /var/www/prestashop/
ServerName prestashopmoriba.com
ServerAlias www.prestashopmoriba.com
<Directory /var/www/prestashop/>
Options FollowSymLinks
AllowOverride All
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/errorprestashop.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/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
</Directory>
# 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".
# 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}/errordolibarr.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
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</VirtualHost>
Puis, j'effectue la commande suivante :
sudo a2ensite dolibarr.conf
sudo a2ensite prestashop.conf
et je désactive 000-default.conf :
sudo a2dissite 000-default.conf
Je fais un redémarrage de apache :
sudo service apache2 restart
Mais quand je lance mon navigateur et que je tape : http://www.prestashopmoriba.com ou http://www.dolibarrmoriba.com
Il m'affiche serveur introuvable
Auriez vous une idée ?
Hors ligne
#2 Le 01/08/2016, à 10:34
- alexandre958
Re : Création de vhosts sous apache2 et ubuntu
Salut, j'ai peut être une idée.
Combien de connexion réseau ton serveur possède-t-il?
J'ai remarqué que tu as un Vhost sur l'adresse ip 172.30.10.61 et l'autre sur l'adresse ip 172.30.10.62
Tu sais que ça veux dire que to' serveur doit avoir 2 cartes réseaux configurer avec SES adresse ip la.
Et tu as modifier le fichier /etc/hosts sur le serveur... C'est sur ton pc client que tu doit faire la modification du fichier hosts.
May the 4th be with you
Hors ligne