Skip to content

Instantly share code, notes, and snippets.

@zachbrowne
Created June 16, 2012 20:20
Show Gist options
  • Save zachbrowne/2942430 to your computer and use it in GitHub Desktop.
Save zachbrowne/2942430 to your computer and use it in GitHub Desktop.
Set Up Nginx Virtual Host
mkdir -p /home/zach/domains/website.com/{public,logs}
nano /home/zach/domains/website.com/public/index.html
server {
listen 80;
server_name www.website.com;
rewrite ^/(.*) http://website.com/$1 permanent;
}
server {
listen 80;
server_name website.com;
access_log /home/zach/domains/website.com/logs/access.log;
error_log /home/zach/domains/website.com/logs/error.log;
location / {
root /home/zach/domains/website.com/public/;
index index.html;
}
}
sudo ln -s /etc/nginx/sites-available/website.com /etc/nginx/sites-enabled/website.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment