# This script should work flawlessly in Ubuntu # Create nginx config file cat > $NGINX_AVAILABLE_VHOSTS/$domain.conf < /var/www/$domain/index.html < $domain

$domain

Hello World, it works!

EOF # Changing permissions chown -R $WEB_USER:www-data /var/www/$domain/ # Enable site by creating symbolic link ln -s $NGINX_AVAILABLE_VHOSTS/$domain.conf $NGINX_ENABLED_VHOSTS/ # Restart echo "Do you wish to restart nginx?" select yn in "Yes" "No"; do case $yn in Yes ) service nginx restart ; break;; No ) exit;; esac done ok "Site Created for $domain"