Last active
August 29, 2015 14:09
-
-
Save tgrrtt/f0bd22d47245f00efae7 to your computer and use it in GitHub Desktop.
New Ubuntu Setup w/ Nginx & Upstart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very helpful with my current project