Skip to content

Instantly share code, notes, and snippets.

@cahlan
Created March 10, 2015 20:49
Show Gist options
  • Save cahlan/336007c62e6716b31a94 to your computer and use it in GitHub Desktop.
Save cahlan/336007c62e6716b31a94 to your computer and use it in GitHub Desktop.
sample nginx for hosting multiple apps/domains on a single droplet
# install nginx
# sudo apt-get install nginx
# configure nginx
# /etc/nginx/sites-available/[myconfigfile]
# create symlink /\ \/
# /etc/nginx/sites-enabled/[myconfigfile]
server {
listen 80;
server_name awesome.com
location / {
proxy_pass http://127.0.0.1:8001/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name radical.com
location / {
proxy_pass http://127.0.0.1:8002/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name someapp.radical.com
location / {
proxy_pass http://127.0.0.1:8003/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
@fredrickJones
Copy link

Cahlan, would you mind putting in a few notes in a readme file to help clarify what needs to change and what doesn't and where some of the information is coming from like the ip address (is it from the droplet or a random one that you can just make up)?

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