#1 Le 30/09/2012, à 23:52
- Tzmagnum
Problème script shell & virtual host apache 2
Bonjour,
Voilà j'ai fais un petit script shell pour créer mes utilisateurs complètement, mais j'ai un petit soucis.
Quand je tappe en ligne de commande :
./addservice.sh User Password
Tout le script marche à part que quand je vais sur http://$User.liberty-chat.be je ne tombe pas sur le index.php qui est dans le dossier /home/$User/http/
Comment faire ?
Voici mon script :
#! /bin/sh
export User=$1
export Password=$2
/usr/sbin/useradd $User -s /bin/false -d /home/$User -m -p $Password
mkdir /home/$User/http
chgrp -R $User /home/$User/http
chown -R $User /home/$User/http
chmod -R 755 /home/$User/http
mysql -u root -p "services" -e "CREATE USER '$User'@'localhost' IDENTIFIED BY '$Password';
GRANT USAGE ON *.* TO '$User'@'localhost' IDENTIFIED BY '$User'
WITH MAX_QUERIES_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS $User;
GRANT ALL PRIVILEGES ON $User.* TO '$User'@'localhost';"
echo "$User IN A 192.168.1.3" >> /etc/bind/liberty-chat.be
echo "<VirtualHost *:80>
ServerAdmin admin@liberty-chat.be
ServerName $User.liberty-chat.be:80
DocumentRoot /home/$User/http/
<Directory /home/$User/http/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.$User.log
LogLevel warn
CustomLog /var/log/apache2/access.$User.log combined
</VirtualHost>" >> /etc/apache2/sites-available/$User.liberty-chat.be
ln -s /etc/apache2/sites-available/$User.liberty-chat.be /etc/apache2/sites-enabled/$User.liberty-chat.be
echo "L'utilisateur est crée."
Merci d'avance.
Hors ligne
#2 Le 01/10/2012, à 00:56
- erpiu
Re : Problème script shell & virtual host apache 2
As-tu bien redémarré ton serveur apache après avoir créé ton nouvel utilisateur?
Hors ligne