Domain létrehozása fcgi-php-apache2 konfiguráción

#!/bin/bash
useradd $1
mkdir /home/$1
mkdir /home/$1/$1.$2
mkdir /home/$1/logs
chown $1:$1 /home/$1 -R *
passwd $1 
passwd -u $1
usermod -s /bin/bash $1
usermod -a -G $1 www-data
chmod 750 /home/$1



echo "<VirtualHost *:80>
 ServerAdmin webmaster@localhost
 ServerName $1.$2
 ServerAlias www.$1.$2
 DocumentRoot /home/$1/$1.$2
 ErrorLog /home/$1/logs/error.log
 CustomLog /home/$1/logs/access.log combined
 
 <IfModule mod_fastcgi.c>
 AddType application/x-httpd-fastphp5 .php
 Action application/x-httpd-fastphp5 /php5-fcgi
 Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi-$1.$2
 FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi-$1.$2 -socket /var/run/php5-fpm-$1.$2.sock -idle-timeout 300 -pass-header Authorization
 </IfModule>
 
</VirtualHost>

<Directory /home/$1/$1.$2/>
 Options FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
</Directory>
" > /etc/apache2/sites-available/$1.$2.conf

echo "[$1.$2]

user = $1
group = $1

listen = /var/run/php5-fpm-$1.$2.sock

listen.owner = www-data
listen.group = www-data

pm = dynamic

pm.max_children = 20

pm.start_servers = 2

pm.min_spare_servers = 1

pm.max_spare_servers = 20

chdir = /" > /etc/php5/fpm/pool.d/$1.$2.conf

a2ensite $1.$2.conf

systemctl restart php5-fpm.service
service apache2 restart

echo 127.0.0.1 $1.$2 >> /etc/hosts

		

Szólj hozzá!