From 7e4a8eafb37debbc5b477ffff95cc4ef702b48c8 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Sun, 8 Dec 2024 14:20:11 -0800 Subject: [PATCH] purge javascript-common if installed, as it creates the /etc/apache2 dir, which we used to detect if apache is already installed --- bin/vhost-enable.sh | 6 ++++++ bin/vhost-exp.sh | 13 +++++++------ install.sh | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/vhost-enable.sh b/bin/vhost-enable.sh index 882a903..23aa83c 100755 --- a/bin/vhost-enable.sh +++ b/bin/vhost-enable.sh @@ -132,6 +132,12 @@ if [[ "$macro" == *"VHost"* ]]; then fi fi fi + # make sure sendmail_path is set for php-fpm + if [[ -f /etc/php/$fpm/fpm/pool.d/$username.conf ]]; then + if ! /bin/grep -q "^php_admin_value\[sendmail_path\]" /etc/php/$fpm/fpm/pool.d/$username.conf; then + echo "php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -fwebmaster@$domain" >> /etc/php/$fpm/fpm/pool.d/$username.conf + fi + fi else echo "VirtualHost dir for $vhost does not exist." exit 1 diff --git a/bin/vhost-exp.sh b/bin/vhost-exp.sh index 9e512ab..b920f8f 100755 --- a/bin/vhost-exp.sh +++ b/bin/vhost-exp.sh @@ -141,15 +141,16 @@ if [[ -d /srv/www/$domain ]]; then fi # /etc/ configs - if [[ -d /srv/www/$domain/.exp/etc ]]; then - echo "cp -a /srv/www/$domain/.exp/etc/* /etc/" - echo "rm -r /srv/www/$domain/.exp/" - echo "systemctl reload apache2.service" - echo "systemctl reload php7.4-fpm" + if [[ -d /srv/www/$domain/.exp/etc/letsencrypt ]]; then + echo "cp -a /srv/www/$domain/.exp/etc/letsencrypt/* /etc/letsencrypt/" + fi + if [[ -f /srv/www/$domain/.exp/etc/ssl/letsencrypt/$domain.pem ]]; then + echo "cp -a /srv/www/$domain/.exp/etc/ssl/letsencrypt/$domain.pem /etc/ssl/letsencrypt/$domain.pem" + echo "vhost-enable.sh -m VHostHTTPS -d $domain" fi echo - echo "NOTE: check for PHP version on new server and adjust /srv/www/$domain/.exp/etc/php/ config and reload command accordingly" + echo "NOTE: check for PHP version changes on the on new server and an custom php-fpm configs in /srv/www/$domain/.exp/etc/php/ from the old server" fi diff --git a/install.sh b/install.sh index 8f56eb5..c7ea49d 100755 --- a/install.sh +++ b/install.sh @@ -19,6 +19,9 @@ if [ -f "/usr/local/bin/vhost.sh" ]; then exit fi +# purge javascript-common, if installed, as it creates the /etc/apache2 dir +apt-get -y purge javascript-common + # check for existing web server software installs if [ -d "/etc/apache2/" ] || [ -d "/etc/php/" ] || [ -d "/etc/varnish/" ]; then echo