2013-01-22 19:54:48 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2014-05-27 20:18:06 +02:00
|
|
|
# This file is part of the phpBB Forum Software package.
|
|
|
|
#
|
|
|
|
# @copyright (c) phpBB Limited <https://www.phpbb.com>
|
|
|
|
# @license GNU General Public License, version 2 (GPL-2.0)
|
|
|
|
#
|
|
|
|
# For full copyright and license information, please see
|
|
|
|
# the docs/CREDITS.txt file.
|
2013-01-22 19:54:48 +01:00
|
|
|
#
|
2013-01-23 00:55:11 +01:00
|
|
|
set -e
|
2013-10-25 00:07:39 +02:00
|
|
|
set -x
|
2013-01-22 19:54:48 +01:00
|
|
|
|
2013-10-25 00:33:19 +02:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y nginx realpath
|
2013-01-22 19:54:48 +01:00
|
|
|
|
|
|
|
sudo service nginx stop
|
|
|
|
|
|
|
|
DIR=$(dirname "$0")
|
2014-03-29 11:52:37 +01:00
|
|
|
USER=$(whoami)
|
2013-01-22 19:54:48 +01:00
|
|
|
PHPBB_ROOT_PATH=$(realpath "$DIR/../phpBB")
|
2018-12-30 23:19:01 +01:00
|
|
|
NGINX_SITE_CONF="/etc/nginx/sites-enabled/default"
|
|
|
|
NGINX_CONF="/etc/nginx/nginx.conf"
|
2014-03-29 11:52:37 +01:00
|
|
|
APP_SOCK=$(realpath "$DIR")/php-app.sock
|
2020-01-09 19:10:25 -06:00
|
|
|
NGINX_PHP_CONF="$DIR/nginx-php.conf"
|
2013-01-22 19:54:48 +01:00
|
|
|
|
2018-01-06 00:09:02 +01:00
|
|
|
# php-fpm
|
|
|
|
PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm"
|
|
|
|
PHP_FPM_CONF="$DIR/php-fpm.conf"
|
|
|
|
|
|
|
|
echo "
|
|
|
|
[global]
|
|
|
|
|
|
|
|
[travis]
|
|
|
|
user = $USER
|
|
|
|
group = $USER
|
|
|
|
listen = $APP_SOCK
|
|
|
|
listen.mode = 0666
|
|
|
|
pm = static
|
|
|
|
pm.max_children = 2
|
|
|
|
|
|
|
|
php_admin_value[memory_limit] = 128M
|
|
|
|
" > $PHP_FPM_CONF
|
|
|
|
|
|
|
|
sudo $PHP_FPM_BIN \
|
|
|
|
--fpm-config "$DIR/php-fpm.conf"
|
2013-01-22 19:54:48 +01:00
|
|
|
|
2014-03-29 11:52:37 +01:00
|
|
|
# nginx
|
2018-12-30 23:19:01 +01:00
|
|
|
sudo sed -i "s/user www-data;/user $USER;/g" $NGINX_CONF
|
2020-01-09 19:10:25 -06:00
|
|
|
sudo cp "$DIR/../phpBB/docs/nginx.sample.conf" "$NGINX_SITE_CONF"
|
|
|
|
sudo sed -i \
|
|
|
|
-e "s/example\.com/localhost/g" \
|
|
|
|
-e "s|root /path/to/phpbb;|root $PHPBB_ROOT_PATH;|g" \
|
|
|
|
$NGINX_SITE_CONF
|
2013-01-22 19:54:48 +01:00
|
|
|
|
2020-01-09 19:10:25 -06:00
|
|
|
# Generate FastCGI configuration for Nginx
|
|
|
|
echo "
|
|
|
|
upstream php {
|
|
|
|
server unix:$APP_SOCK;
|
|
|
|
}
|
|
|
|
" > $NGINX_PHP_CONF
|
|
|
|
|
|
|
|
sudo mv "$NGINX_PHP_CONF" /etc/nginx/conf.d/php.conf
|
|
|
|
|
|
|
|
sudo nginx -T
|
2013-01-22 19:54:48 +01:00
|
|
|
sudo service nginx start
|