创建一个php5-fpm的pool配置文件(使用特定用户执行)
if [ ! $1 ]; then
echo “no name specified”
exit
fi
echo “[$1]” > /etc/php5/fpm/pool.d/$1.conf
echo “user = $1” >> /etc/php5/fpm/pool.d/$1.conf
echo “group = $1” >> /etc/php5/fpm/pool.d/$1.conf
echo “listen = /var/run/php5-fpm-$1.sock” >> /etc/php5/fpm/pool.d/$1.conf
echo “pm = dynamic” >> /etc/php5/fpm/pool.d/$1.conf
echo “pm.max_children = 10” >> /etc/php5/fpm/pool.d/$1.conf
echo “pm.start_servers = 2” >> /etc/php5/fpm/pool.d/$1.conf
echo “pm.min_spare_servers = 1” >> /etc/php5/fpm/pool.d/$1.conf
echo “pm.max_spare_servers = 3” >> /etc/php5/fpm/pool.d/$1.conf
echo “#chroot = /home/$1” >> /etc/php5/fpm/pool.d/$1.conf
echo “chdir = /” >> /etc/php5/fpm/pool.d/$1.conf
为用户创建家文件夹, 并设置相关权限
if [ ! $1 ]; then
echo “no user specified”
exit
fi
mkdir /home/$1
chown $1:$1 /home/$1 -R
chmod 755 /home/$1 -R
启用一个nginx的站点
if [ ! $1 ]; then
echo “no site specified”
exit
fi
cd /etc/nginx/sites-enabled
cp -s ../sites-available/$1 $1
发表评论