Skip to content

Instantly share code, notes, and snippets.

@dstroot
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstroot/8817275 to your computer and use it in GitHub Desktop.
Save dstroot/8817275 to your computer and use it in GitHub Desktop.
Setup NGINX on Ubuntu
#!/bin/bash
###############################################
# To use:
# wget https://raw.github.com/gist/4411254
# chmod 777 setup_nginx.sh
# ./setup_nginx.sh
###############################################
echo "*****************************************"
echo " Step 1: Install nngix"
echo "*****************************************"
sudo apt-get install nginx
sudo service nginx start
echo "*****************************************"
echo " Step 2: Confirm NGINX is running"
echo "*****************************************"
echo "You can confirm that nginx has been installed as your web"
echo "server by directing your browser to your IP address:"
# Reveals your server’s IP address:
ifconfig eth0 | grep inet | awk '{ print $2 }'
echo "When you visit your IP address page in your browser"
echo "you will see the words: 'Welcome to nginx'"
echo "To ensure that nginx will be up after reboots,"
echo "it’s best to add it to the startup."
update-rc.d nginx defaults
echo "You may see a message like:"
echo "System start/stop links for /etc/init.d/nginx already exist."
echo "If that is the case, then nginx is set up to run on startup, and you are all set."
################################################################################
# You can setup multiple domain with nginx, forwarding to multiple node.js processes.
# For example to achieve this:
#
# domain1.com -> to Node.js process running locally http://127.0.0.1:4000
# domain2.com -> to Node.js process running locally http://127.0.0.1:5000
#################################################################################
# http://blog.donaldderek.com/2013/08/cf-i-configure-your-staging-machine-with-node-js-and-nginx/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment