Skip to content

Instantly share code, notes, and snippets.

@grabbeh
Last active December 21, 2015 04:09
Show Gist options
  • Save grabbeh/6247736 to your computer and use it in GitHub Desktop.
Save grabbeh/6247736 to your computer and use it in GitHub Desktop.
Nginx conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
# specify the location of the Express app you want to serve up
upstream helloworld {
server localhost:3000;
}
# calls to www.grabeh.net will be rewritten to grabeh.net
server {
listen 80;
server_name www.grabeh.net *.grabeh.net;
rewrite ^(.*) http://grabeh.net$1 permanent;
}
# specify what will happen when a request to helloworld.[your domain] is made.
# Here we are proxying the Express app through.
server {
listen 80;
server_name helloworld.grabeh.net;
location / {
try_files $uri @helloworld;
}
location @helloworld {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $proxy_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://helloworld;
}
}
# basic element where we're sending index.html for requests to grabeh.net/
server {
listen 80;
server_name grabeh.net;
location / {
root html/home;
index index.html index.htm;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment