Advertisement
wicochandra

Change NGINX configuration root

Mar 25th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.25 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. CONFIG_FILE="/etc/nginx/sites-available/project"
  4. DIR=$1
  5.  
  6. if [ $# -eq 0 ]
  7.   then
  8.     DIR='.'
  9. fi
  10.  
  11. DIR=$(readlink -f $DIR)
  12. CONFIG=$(sed "s@root[^\n]*@root $DIR;@g" < $CONFIG_FILE)
  13.  
  14. $(echo "$CONFIG" > $CONFIG_FILE)
  15. service nginx reload
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement