Skip to content

Instantly share code, notes, and snippets.

@tiagopog
Created June 16, 2015 23:11
Show Gist options
  • Select an option

  • Save tiagopog/f0784f96f666c422b6b4 to your computer and use it in GitHub Desktop.

Select an option

Save tiagopog/f0784f96f666c422b6b4 to your computer and use it in GitHub Desktop.
Localhost's NGINX config file.
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
upstream rails {
server localhost:3000;
}
upstream node {
server localhost:5000;
}
server {
listen 80;
client_max_body_size 20M;
server_name beautydate.dev;
access_log /var/log/nginx/bdt.access.log;
error_log /var/log/nginx/bdt.error.log;
location / {
root /var/www/beautydate/current/public;
try_files $uri $uri/ /index.html;
proxy_set_header X-Real-IP $remote_addr;
if (-f $request_filename) {
break;
}
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://rails;
# Or you can choose an upstream using Unix sockets:
# proxy_pass http://puma;
break;
}
}
}
server {
listen 80;
server_name localhost azsync.dev;
access_log /var/log/nginx/azsync.access.log;
error_log /var/log/nginx/azsync.error.log;
location / {
proxy_pass http://node;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 86400;
}
}
server {
listen 80;
server_name foobar.dev;
location / {
root /Users/tiagopog/Dev/sandbox/frontend/foobar/;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment