2017-03-25 18:41:47 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
#move to script directory so all relative paths work
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
|
|
|
|
#includes
|
|
|
|
|
. ./config.sh
|
|
|
|
|
. ./colors.sh
|
|
|
|
|
|
2017-04-01 23:34:06 +02:00
|
|
|
#set the current working directory
|
|
|
|
|
cwd=$(pwd)
|
|
|
|
|
|
2017-03-25 18:41:47 +01:00
|
|
|
#send a message
|
|
|
|
|
verbose "Installing the web server"
|
|
|
|
|
|
2017-03-26 00:49:24 +01:00
|
|
|
#install nginx
|
|
|
|
|
pkg install --yes nginx
|
2017-03-25 18:41:47 +01:00
|
|
|
|
2017-03-26 00:49:24 +01:00
|
|
|
#enable nginx
|
|
|
|
|
echo 'nginx_enable="YES"' >> /etc/rc.conf
|
2017-04-01 11:56:09 +02:00
|
|
|
echo 'php_fpm_enable="YES"' >> /etc/rc.conf
|
2017-03-25 18:41:47 +01:00
|
|
|
|
|
|
|
|
#install dependencies
|
|
|
|
|
if [ ."$php_version" = ."5" ]; then
|
2017-04-01 20:13:31 +02:00
|
|
|
#pkg install --yes php56 php56-phar php56-pgsql php56-pdo php56-pdo_pgsql php56-pdo_odbc php56-pdo_sqlite php56-json php56-gd
|
|
|
|
|
#pkg install --yes php56-imap php56-ldap php56-mcrypt php56-openssl php56-sockets php56-simplexml php56-xml php56-session
|
2017-03-25 18:41:47 +01:00
|
|
|
fi
|
|
|
|
|
if [ ."$php_version" = ."7" ]; then
|
2017-04-01 20:13:31 +02:00
|
|
|
#pkg install --yes php70 php70-phar php70-pgsql php70-pdo php70-pdo_pgsql php70-pdo_odbc php70-pdo_sqlite php70-json php70-gd
|
|
|
|
|
#pkg install --yes php70-imap php70-ldap php70-mcrypt php70-openssl php70-sockets php70-simplexml php70-xml php70-session
|
|
|
|
|
|
|
|
|
|
portsnap fetch update
|
2017-04-01 23:17:42 +02:00
|
|
|
cd /usr/ports/lang/php70/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/archivers/php70-phar/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/databases/php70-pgsql/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/databases/php70-pdo/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/databases/php70-pdo_pgsql/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/databases/php70-pdo_odbc/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/databases/php70-pdo_sqlite/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/devel/php70-json/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/graphics/php70-gd/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/mail/php70-imap/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/net/php70-ldap/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/security/php70-mcrypt/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/security/php70-openssl/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/net/php70-sockets/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/textproc/php70-simplexml/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/textproc/php70-xml/ && make install clean BATCH=yes
|
|
|
|
|
cd /usr/ports/www/php70-session/ && make install clean BATCH=yes
|
2017-03-25 18:41:47 +01:00
|
|
|
fi
|
|
|
|
|
|
2017-04-01 23:34:06 +02:00
|
|
|
#reset the current working directory
|
|
|
|
|
cd $cwd
|
|
|
|
|
|
2017-04-01 02:56:08 +02:00
|
|
|
#update the list of executables in the path
|
|
|
|
|
rehash
|
|
|
|
|
|
2017-03-25 18:41:47 +01:00
|
|
|
#enable fusionpbx nginx config
|
2017-03-26 22:07:55 +02:00
|
|
|
mv /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf-orig
|
|
|
|
|
cp nginx/nginx.conf /usr/local/etc/nginx
|
|
|
|
|
mkdir -p /usr/local/etc/nginx/conf.d
|
2017-03-27 10:28:40 +02:00
|
|
|
mkdir -p /usr/local/etc/nginx/sites-available/
|
|
|
|
|
mkdir -p /usr/local/etc/nginx/sites-enabled/
|
|
|
|
|
cp nginx/fusionpbx.conf /usr/local/etc/nginx/sites-available/fusionpbx
|
|
|
|
|
ln -s /usr/local/etc/nginx/sites-available/fusionpbx /usr/local/etc/nginx/sites-enabled/fusionpbx
|
2017-03-25 18:41:47 +01:00
|
|
|
|
|
|
|
|
#self signed certificate
|
2017-03-26 00:49:24 +01:00
|
|
|
#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
|
2017-03-25 18:41:47 +01:00
|
|
|
|
|
|
|
|
#add the letsencrypt directory
|
|
|
|
|
mkdir -p /var/www/letsencrypt/
|
|
|
|
|
|
2017-03-26 00:49:24 +01:00
|
|
|
#restart php fpm and nginx
|
|
|
|
|
service php-fpm restart
|
2017-03-25 18:41:47 +01:00
|
|
|
service nginx restart
|
2017-03-26 00:49:24 +01:00
|
|
|
|