Skip to content

Instantly share code, notes, and snippets.

@sholloway
Last active December 13, 2015 20:19
Show Gist options
  • Save sholloway/4969174 to your computer and use it in GitHub Desktop.
Save sholloway/4969174 to your computer and use it in GitHub Desktop.
setting up multiple sites on nginx locally
# install
brew install nginx
#Add nginx to the path
#set up sites-available, sites-enabled
cd /usr/local/etc/nginx/
mkdir sites-available sites-enabled
#make sure that the primary nginx config file has included the sites-enabled dir
#on my system that's at:
#/usr/local/etc/nginx/nginx.conf
#create the site's dir
mkdir -p /home/demo/public_html/domain1.com/{public,private,log,backup}
#add an index.html to /home/demo/public_html/domain1.com/public
#To add a site for hosting
#create a virtual hosts file for the site. The file extension for the host file doesn't matter.
mate /usr/local/etc/nginx/sites-available/domain1.com
#Look at gist nginx_virtual_host_example for guidance on the virtual host file
#enable the site via symlink
sudo ln -s /usr/local/etc/nginx/sites-available/domain1.com /usr/local/etc/nginx/sites-enabled/domain1.com
#place a loopback in the local host file
#on my machine it's at
#/private/etc/hosts
#add a line like: 127.0.0.1 domain1.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment