Skip to content

Instantly share code, notes, and snippets.

@PatelUtkarsh
Created May 11, 2016 05:54
Show Gist options
  • Save PatelUtkarsh/f6eb7764f8858f173f53ddc72084cbc6 to your computer and use it in GitHub Desktop.
Save PatelUtkarsh/f6eb7764f8858f173f53ddc72084cbc6 to your computer and use it in GitHub Desktop.
Setup vip-go in local environment for site which are already created with easyengine.
#!bin/bash
#
# NOTE:This file takes param as site name for
#
# This script currenty only works with easyengine.
#
# What this does essentially is clones mu-plugin repo of vip-mu-plugins-public
# and write nginx rule to handle static files via php.
#
# WARNING: This does not match extact vip go environment like php version and stuff
# for that please use vagrant : https://github.com/Automattic/vip-go-quickstart
#
# WARNING-2: Only use this locally.
#
# Usage: sudo bash ee-vip-go-local.sh example.com
if [ -z "$1" ]
then
echo "Please add first argument as site name" >&2
exit 1
fi
if [ "$EUID" -ne 0 ]
then
echo "Please run as root" >&2
exit 1
fi
CURRENT_DIR=$PWD
SITE_NAME=$1
DIR_SITE="/var/www/$SITE_NAME/"
if [ ! -d "$DIR_SITE" ]; then
echo "Wrong name of site maybe pass the name which you used while creating site in command 'ee site create'"
exit 1
fi
git clone -q https://github.com/Automattic/vip-mu-plugins-public.git htdocs/wp-content/mu-plugins
chown -R www-data:www-data htdocs/wp-content/mu-plugins
cat > conf/nginx/vip.conf << EOL
location /_static/ {
fastcgi_pass php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/${SITE_NAME}/htdocs/wp-content/mu-plugins/http-concat/ngx-http-concat.php;
}
EOL
service nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment