Skip to content

Instantly share code, notes, and snippets.

@lolobosse
Last active October 24, 2017 15:47
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 lolobosse/127b767a5ba14c5dcaea1bb09f601642 to your computer and use it in GitHub Desktop.
Save lolobosse/127b767a5ba14c5dcaea1bb09f601642 to your computer and use it in GitHub Desktop.
daemon off;
#Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
http {
gzip on;
gzip_comp_level 2;
gzip_min_length 512;
server_tokens off;
log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id';
access_log logs/nginx/access.log l2met;
error_log logs/nginx/error.log;
include mime.types;
default_type application/octet-stream;
sendfile on;
#Must read the body in 5 seconds.
client_body_timeout 5;
upstream app_server {
server unix:/tmp/nginx.socket fail_timeout=0;
}
server {
listen <%= ENV["PORT"] %>;
server_name _;
keepalive_timeout 5;
# root ./;
#index index.html index.htm;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# 3001 needs to be hardcoded on the node server/webpack or whatsoever
proxy_pass http://127.0.0.1:3001;
client_max_body_size 15m;
}
location /blog {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass LOCATION OF MY BLOG;
client_max_body_size 15m;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment