Skip to content

Instantly share code, notes, and snippets.

@ziadoz ziadoz/reloadvhosts.sh
Last active Jan 11, 2017

Embed
What would you like to do?
Automatically Symlink Virtualhosts
# 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
You can’t perform that action at this time.