fusionpbx-install.sh/debian/resources/nginx.sh

85 lines
2.3 KiB
Bash
Raw Normal View History

2016-04-29 21:24:22 +02:00
#!/bin/sh
#move to script directory so all relative paths work
cd "$(dirname "$0")"
2017-03-04 20:54:32 +01:00
#includes
. ./config.sh
. ./colors.sh
2017-03-05 18:30:59 +01:00
. ./environment.sh
2016-04-29 21:24:22 +02:00
#send a message
verbose "Installing the web server"
2016-04-29 21:24:22 +02:00
2019-02-17 16:51:19 +01:00
#change the version of php for arm
if [ ."$cpu_architecture" = ."arm" ]; then
2018-11-06 07:35:42 +01:00
#Pi2 and Pi3 Raspbian
#Odroid
if [ ."$os_codename" = ."stretch" ]; then
php_version=7.2
else
php_version=5.6
fi
fi
2017-03-05 18:42:12 +01:00
2019-08-21 01:40:58 +02:00
#set the version of php
if [ ."$os_codename" = ."bullseye" ]; then
php_version=7.4
fi
2019-08-21 01:40:58 +02:00
if [ ."$os_codename" = ."buster" ]; then
php_version=7.3
fi
if [ ."$os_codename" = ."stretch" ]; then
php_version=7.1
fi
if [ ."$os_codename" = ."jessie" ]; then
php_version=7.1
fi
2016-04-29 21:24:22 +02:00
#enable fusionpbx nginx config
cp nginx/fusionpbx /etc/nginx/sites-available/fusionpbx
2017-03-05 19:04:41 +01:00
#prepare socket name
2018-10-10 04:38:20 +02:00
if [ ."$php_version" = ."5.6" ]; then
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php5-fpm.sock;#g'
2017-03-04 21:38:24 +01:00
fi
2018-10-10 04:38:20 +02:00
if [ ."$php_version" = ."7.0" ]; then
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.0-fpm.sock;#g'
fi
if [ ."$php_version" = ."7.1" ]; then
2018-03-07 05:15:39 +01:00
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.1-fpm.sock;#g'
fi
2018-10-10 04:38:20 +02:00
if [ ."$php_version" = ."7.2" ]; then
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.2-fpm.sock;#g'
fi
2019-08-21 01:38:47 +02:00
if [ ."$php_version" = ."7.3" ]; then
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.3-fpm.sock;#g'
fi
if [ ."$php_version" = ."7.4" ]; then
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.4-fpm.sock;#g'
fi
2016-04-29 21:24:22 +02:00
ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbx
#self signed certificate
ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.key
ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crt
#remove the default site
2017-01-15 08:11:53 +01:00
rm /etc/nginx/sites-enabled/default
#update config if LetsEncrypt folder is unwanted
if [ .$letsencrypt_folder = .false ]; then
sed -i '151,155d' /etc/nginx/sites-available/fusionpbx
fi
2017-02-02 23:21:49 +01:00
#add the letsencrypt directory
if [ .$letsencrypt_folder = .true ]; then
mkdir -p /var/www/letsencrypt/
fi
2017-02-02 23:21:49 +01:00
2019-02-17 17:04:49 +01:00
#flush systemd cache
systemctl daemon-reload
2017-01-15 08:11:53 +01:00
#restart nginx
service nginx restart