diff --git a/bin/vhost-user-mod.sh b/bin/vhost-user-mod.sh index 1df321b..00979d2 100755 --- a/bin/vhost-user-mod.sh +++ b/bin/vhost-user-mod.sh @@ -57,7 +57,7 @@ if /bin/grep -q "^$username:" /etc/passwd; then if [[ -n "$fpmmax" ]]; then vhost::set-phpVersion if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then - sed -i "s|pm.max_children.*|pm.max_children = $fpmmax|g" /etc/php/8.1/fpm/pool.d/$username.conf + sed -i "s|pm.max_children.*|pm.max_children = $fpmmax|g" /etc/php/$phpVersion/fpm/pool.d/$username.conf else echo "ERROR: PHP config for $username does not exist." exit 1 diff --git a/etc/apache2/mods-available/macro.conf b/etc/apache2/mods-available/macro.conf index 1540b6e..3cee174 100644 --- a/etc/apache2/mods-available/macro.conf +++ b/etc/apache2/mods-available/macro.conf @@ -39,7 +39,7 @@ RewriteCond %{REQUEST_URI} ^/cgi-bin/.* RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT] - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -52,7 +52,7 @@ DocumentRoot /srv/www/$vhost/html/$subdomain - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -78,7 +78,7 @@ - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -93,7 +93,7 @@ RewriteCond %{REQUEST_URI} ^/cgi-bin/.* RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT] - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" SSLEngine on SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem @@ -129,7 +129,7 @@ - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -139,7 +139,7 @@ DocumentRoot /srv/www/$vhost/html/$subdomain - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" SSLEngine on SSLCertificateFile /etc/ssl/letsencrypt/$subdomain.$vhost.pem @@ -160,7 +160,7 @@ RewriteCond %{REQUEST_URI} ^/cgi-bin/.* RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT] - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -187,7 +187,7 @@ DocumentRoot /srv/www/$vhost/html/$subdomain - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -299,7 +299,7 @@ RewriteCond %{REQUEST_URI} ^/cgi-bin/.* RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT] - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -324,7 +324,7 @@ - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" @@ -339,7 +339,7 @@ RewriteCond %{REQUEST_URI} ^/cgi-bin/.* RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT] - SetHandler "proxy:unix:/run/php/php8.1-fpm-$username.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost" SSLEngine on SSLCertificateFile /etc/ssl/letsencrypt/$alias.pem diff --git a/install.sh b/install.sh index 9091c4c..99c5313 100755 --- a/install.sh +++ b/install.sh @@ -44,6 +44,9 @@ fi # install systemd files and reload cp systemd/* /usr/local/lib/systemd/system/ chmod 644 /usr/local/lib/systemd/system/* +# set php version +sed -i "s|PHPVERSION|$phpVersion|g" /usr/local/lib/systemd/system/vhost-reload-php.path +sed -i "s|PHPVERSION|$phpVersion|g" /usr/local/lib/systemd/system/vhost-reload-php.service systemctl daemon-reload # install pwgen, used to create random passwords @@ -97,6 +100,8 @@ chown root:root /etc/apache2/mods-available/*.conf sed -i "s|SSLProtocol.*|SSLProtocol TLSv1.2|g" /etc/apache2/mods-available/ssl.conf # set vhost subodmain to domain name of server, users may want to consider changing this to a custom domain. sed -i "s|example.com|$vhostdomain|g" /etc/apache2/mods-available/macro.conf +# set php version +sed -i "s|PHPVERSION|$phpVersion|g" /etc/apache2/mods-available/macro.conf # a2enmod proxy_fcgi rewrite headers expires ssl http2 remoteip macro a2enmod cgid proxy_fcgi proxy_http rewrite headers expires ssl http2 macro # # sed -i "s|CustomLog|#CustomLog|g" /etc/apache2/sites-available/000-default.conf diff --git a/systemd/vhost-reload-php.path b/systemd/vhost-reload-php.path index 2142447..6d34c0a 100644 --- a/systemd/vhost-reload-php.path +++ b/systemd/vhost-reload-php.path @@ -2,7 +2,7 @@ Description="Reload PHP-FPM on changes to pool config files" [Path] -PathChanged=/etc/php/8.1/fpm/pool.d/ +PathChanged=/etc/php/PHPVERSION/fpm/pool.d/ Unit=vhost-reload-php.service [Install] diff --git a/systemd/vhost-reload-php.service b/systemd/vhost-reload-php.service index b84446c..c283498 100644 --- a/systemd/vhost-reload-php.service +++ b/systemd/vhost-reload-php.service @@ -4,4 +4,4 @@ Description=Reload PHP-FPM [Service] Type=oneshot ExecStartPre=sleep 2 -ExecStart=systemctl try-reload-or-restart php8.1-fpm +ExecStart=systemctl try-reload-or-restart phpPHPVERSION-fpm