2014-02-18 02:26:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2014-02-18 02:37:56 +00:00
|
|
|
# Set up the Travis-CI test environment for Shimmie.
|
2014-02-18 02:26:06 +00:00
|
|
|
# (this script should be run as root via sudo)
|
|
|
|
#
|
|
|
|
# @copyright (c) 2014 jgen
|
|
|
|
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
|
|
#
|
|
|
|
|
|
|
|
# Exit immediately if a command exits with a non-zero status.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Install the necessary packages
|
2014-02-18 04:18:00 +00:00
|
|
|
sudo apt-get install -y nginx realpath php5-fpm php5-mysql --fix-missing
|
2014-02-18 02:26:06 +00:00
|
|
|
|
|
|
|
# Stop the daemons
|
|
|
|
sudo service nginx stop
|
|
|
|
sudo /etc/init.d/php5-fpm stop
|
|
|
|
|
|
|
|
SHIMMIE_ROOT=$(realpath "$0")
|
|
|
|
|
2014-02-18 04:18:00 +00:00
|
|
|
# shimmie needs to be able to create directories for images, etc.
|
|
|
|
# (permissions of 777 are bad, but it definitely works)
|
|
|
|
sudo chmod -R 0777 $SHIMMIE_ROOT
|
|
|
|
|
2014-02-18 02:26:06 +00:00
|
|
|
NGINX_CONF="/etc/nginx/sites-enabled/default"
|
|
|
|
|
2014-02-18 05:29:26 +00:00
|
|
|
sudo cat /etc/nginx/nginx.conf
|
|
|
|
|
2014-02-18 02:26:06 +00:00
|
|
|
# nginx configuration
|
|
|
|
echo "
|
|
|
|
server {
|
|
|
|
listen 80 default;
|
|
|
|
|
|
|
|
root $SHIMMIE_ROOT/;
|
2014-02-18 04:23:20 +00:00
|
|
|
index index.php;
|
2014-02-18 02:26:06 +00:00
|
|
|
|
|
|
|
location ~ /_?(images|thumbs)/ {
|
|
|
|
default_type image/jpeg;
|
|
|
|
}
|
2014-02-18 05:06:58 +00:00
|
|
|
|
|
|
|
# For the Nice URLs in Shimmie.
|
2014-02-18 05:29:26 +00:00
|
|
|
#location / {
|
|
|
|
# if (!-e $request_filename) {
|
|
|
|
# rewrite ^(.*)$ /index.php?q=$1 last;
|
|
|
|
# break;
|
|
|
|
# }
|
|
|
|
#}
|
2014-02-18 05:06:58 +00:00
|
|
|
|
2014-02-18 02:26:06 +00:00
|
|
|
location ~ \.php($|/) {
|
2014-02-18 05:06:58 +00:00
|
|
|
fastcgi_pass 127.0.0.1:9000;
|
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
fastcgi_read_timeout 600;
|
2014-02-18 02:26:06 +00:00
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
" | sudo tee $NGINX_CONF > /dev/null
|
|
|
|
|
|
|
|
# Start daemons
|
|
|
|
sudo /etc/init.d/php5-fpm start
|
|
|
|
sudo service nginx start
|