Skip to content

Instantly share code, notes, and snippets.

@wicochandra
Created March 26, 2015 04:35
Show Gist options
  • Save wicochandra/6012031585bc4371f149 to your computer and use it in GitHub Desktop.
Save wicochandra/6012031585bc4371f149 to your computer and use it in GitHub Desktop.
Changed root directory in nginx configuration.
#! /bin/sh
CONFIG_FILE="/etc/nginx/sites-available/project"
DIR=$1
if [ $# -eq 0 ]
then
DIR='.'
fi
DIR=$(readlink -f $DIR)
CONFIG=$(sed "s@root[^\n]*@root $DIR;@g" < $CONFIG_FILE)
echo "$CONFIG" > $CONFIG_FILE
service nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment