User standard dans le pool fpm

Utilisation du user vagrant dans le pool fpm et ainsi pouvoir utiliser
simplement les cli php sans problème de permission
This commit is contained in:
Michael RICOIS 2017-01-17 13:56:12 +01:00
parent 7db387c94b
commit 18fb98a157
2 changed files with 12 additions and 6 deletions

View File

@ -38,7 +38,7 @@ Vagrant.configure(2) do |config|
# the path on the guest to mount the folder. And the optional third # the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options. # argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data" # config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder "../../", "/home/vhosts", owner: "www-data", group: "www-data" config.vm.synced_folder "../../", "/home/vhosts"
# Provider-specific configuration so you can fine-tune various # Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options. # backing providers for Vagrant. These expose provider-specific options.

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VARGANTDEV=1 VARGANTDEV=1
DIR=/vagrant DIR=/vagrant
DIRDATA=$DIR/data DIRDATA=$DIR/data
@ -84,7 +86,11 @@ if [ ! -f /usr/bin/php5 ]; then
sudo sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php5/fpm/php.ini sudo sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php5/fpm/php.ini
sudo sed -i -e 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/g' /etc/php5/fpm/php.ini sudo sed -i -e 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/g' /etc/php5/fpm/php.ini
sudo sed -i -e 's/;opcache.enable=0/opcache.enable=1/g' /etc/php5/fpm/php.ini sudo sed -i -e 's/;opcache.enable=0/opcache.enable=1/g' /etc/php5/fpm/php.ini
sudo cp -f $DIRDATA/PHP/xdebug.ini /etc/php5/mods-available/xdebug.ini sudo cp -f $DIRDATA/PHP/xdebug.ini /etc/php5/mods-available/xdebug.ini
# Pool user
sudo sed -i -e 's/user = www-data/user = vagrant/g' /etc/php5/fpm/pool.d/www.conf
sudo sed -i -e 's/group = www-data/group = vagrant/g' /etc/php5/fpm/pool.d/www.conf
sudo sed -i -e 's/listen.group = www-data/listen.group = www-data/g' /etc/php5/fpm/pool.d/www.conf
# --- Browscap # --- Browscap
sudo cp -f $DIRDATA/PHP/php_browscap.ini /etc/php5/fpm/ sudo cp -f $DIRDATA/PHP/php_browscap.ini /etc/php5/fpm/
@ -101,7 +107,7 @@ if [ ! -f /usr/bin/php5 ]; then
sudo cp $DIRDATA/ChartDirector/chartdir.ini /etc/php5/mods-available/ sudo cp $DIRDATA/ChartDirector/chartdir.ini /etc/php5/mods-available/
sudo php5enmod chartdir sudo php5enmod chartdir
fi fi
sudo service php5-fpm restart
fi fi
# --- Composer # --- Composer
@ -116,8 +122,8 @@ if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ]; then
wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz"
if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ]; then if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ]; then
tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/ tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/
mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql mysql -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql
mysql -hlocalhost -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql mysql -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql
sudo service mysql restart sudo service mysql restart
cp $DIRDATA/Apps/config.inc.php /home/vhosts/$PHPMYADMIN_DIR/ cp $DIRDATA/Apps/config.inc.php /home/vhosts/$PHPMYADMIN_DIR/
chmod 0644 /home/vhosts/$PHPMYADMIN_DIR/config.inc.php chmod 0644 /home/vhosts/$PHPMYADMIN_DIR/config.inc.php
@ -164,7 +170,7 @@ for f in *.conf; do
continue continue
fi fi
if [ -f $f ]; then if [ -f $f ]; then
sudo cp -vf $f /etc/apache2/sites-available/; sudo cp -vf $f /etc/apache2/sites-available/
VHOSTS+=" $f" VHOSTS+=" $f"
fi fi
done; done;