Last active
January 11, 2017 23:42
-
-
Save ziadoz/862bfc6fa4b579843219306b7a66fa19 to your computer and use it in GitHub Desktop.
Automatically Symlink Virtualhosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Symlink web server virtualhost configutions into the sites-enabled directory. | |
# Usage: reloadvhosts /path/to/websites | |
# reloadvhosts /path/to/websites *-live.conf | |
# reloadvhosts /path/to/websites apache2 | |
reloadvhosts() { | |
local vhost_dir=${1:-/var/www/vhosts} | |
local conf_name=${2:-*dev.conf} | |
local web_server=${3:-nginx} | |
sudo find /etc/$web_server/sites-enabled/ -type l -exec rm {} \; | |
sudo find $vhost_dir -name $conf_name -exec ln -sf {} /etc/$web_server/sites-enabled/ \; | |
sudo service $web_server restart | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment