Skip to content

Instantly share code, notes, and snippets.

@andrey-yantsen
Created August 19, 2013 00:00
Show Gist options
  • Save andrey-yantsen/6264752 to your computer and use it in GitHub Desktop.
Save andrey-yantsen/6264752 to your computer and use it in GitHub Desktop.
server {
listen 80;
root @HOTELLOOK_ROOT@/;
index index.php index.html;
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.(js|css|less|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
location ~ /(robots\.txt|sitemap.*\.xml)$ {
try_files /assets/vhostroot/$host/$uri =404;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
location ~ /\. {
deny all;
}
location ~ \.php$ {
fastcgi_pass unix:@PHP_FPM_SOCK@;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root/index.php;
}
}
[global]
[travis]
user = @USER@
group = @USER@
listen = @PHP_FPM_SOCK@
pm = static
pm.max_children = 5
php_admin_value[memory_limit] = 256M
#!/bin/bash
set -e
sudo apt-get update -qq
sudo apt-get install -qq realpath
DIR=$(dirname "$0")
HOTELLOOK_ROOT=$(realpath "$DIR/../../..")
sudo wget -q 'http://tempdownloads.browserscap.com/stream.asp?PHP_BrowsCapINI' -O /etc/browscap.ini
if [ -z "$TEST_SUITE_NAME" ] || [ "$TEST_SUITE_NAME" = "acceptance" ]
then
echo "Installing nginx"
sudo apt-get install -qq nginx
# Setup PHP-FPM
echo "Configuring php-fpm"
PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm"
PHP_FPM_CONF="$DIR/php-fpm.conf"
PHP_FPM_SOCK=$(realpath "$DIR")/php-fpm.sock
USER=$(whoami)
# Adjust php-fpm.ini
sed -i "s/@USER@/$USER/g" "$DIR/php-fpm.ini"
sed -i "s|@PHP_FPM_SOCK@|$PHP_FPM_SOCK|g" "$DIR/php-fpm.ini"
# Setup nginx
echo "Configuring nginx"
NGINX_CONF="/etc/nginx/sites-enabled/default"
sed -i "s|@HOTELLOOK_ROOT@|$HOTELLOOK_ROOT|g" "$DIR/nginx.conf"
sed -i "s|@PHP_FPM_SOCK@|$PHP_FPM_SOCK|g" "$DIR/nginx.conf"
sudo cp "$DIR/nginx.conf" $NGINX_CONF
# Start daemons
echo "Starting php-fpm"
sudo $PHP_FPM_BIN --fpm-config "$DIR/php-fpm.ini"
echo "Starting nginx"
sudo service nginx start
if ! [ -z "$HOSTNAME" ]
then
sed -i "s|localhost|$HOSTNAME|g" "$DIR/../acceptance.suite.yml"
fi
fi
cp $DIR/config.php $HOTELLOOK_ROOT/protected/config/local.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment