Skip to content

Instantly share code, notes, and snippets.

@tgrrtt
Last active August 29, 2015 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgrrtt/f0bd22d47245f00efae7 to your computer and use it in GitHub Desktop.
Save tgrrtt/f0bd22d47245f00efae7 to your computer and use it in GitHub Desktop.
New Ubuntu Setup w/ Nginx & Upstart
curl -sL https://deb.nodesource.com/setup | sudo bash - &&
sudo apt-get install -y nodejs
sudo apt-get update &&
sudo apt-get install nginx &&
sudo apt-get install git
## upgrade aps and resolve deps with the more important ones
sudo apt-get dist-upgrade
#chagne to root
sudo su
#add job to nginx
sudo cat > /etc/nginx/conf.d/$projectname.conf
## start cat
server {
listen 80;
server_name $SERVER_ADDRESSt;
location / {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
# endcat
# add job to upstart
#start upstart
sudo cat > /etc/init/$projectname.conf
## enter this stuff
description "Whatver"
author "Your info ifya want"
start on started mountall
stop on shutdown
respawn
respawn limit 99 5
script
# path to executable
sudo node /home/git/mysite/server.js >> /var/log/mysite.log 2>&1
end script
post-start script
end script
# end cat
# start nginx
sudo service nginx start
# or restart
@SniperProSerria117
Copy link

Thank you very helpful with my current project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment