Skip to content

Instantly share code, notes, and snippets.

@Day0Dreamer
Created May 15, 2019 14:05
Show Gist options
  • Save Day0Dreamer/c77fe3a1c4f70b61764fcbc095fd221d to your computer and use it in GitHub Desktop.
Save Day0Dreamer/c77fe3a1c4f70b61764fcbc095fd221d to your computer and use it in GitHub Desktop.
worker_processes 1;
user nobody nogroup;
# 'user nobody nobody;' for systems with 'nobody' as a group instead
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # set to 'on' if nginx worker_processes > 1
# 'use epoll;' to enable for Linux 2.6+
# 'use kqueue;' to enable for FreeBSD, OSX
}
http {
include mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# for UNIX domain socket setups
server unix:/tmp/gunicorn.sock fail_timeout=0;
# for a TCP configuration
# server 159.69.119.223:8000 fail_timeout=0;
}
server {
# if no Host match, close the connection to prevent host spoofing
listen 443 default_server;
return 444;
}
server {
# use 'listen 80 deferred;' for Linux
# use 'listen 80 accept_filter=httpready;' for FreeBSD
listen 443 deferred;
client_max_body_size 4G;
# set the correct host(s) for your site
# server_name example.com www.example.com;
server_name dd.glowingcube.com;
keepalive_timeout 5;
# path for static files
root /web/dd_flask;
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
#proxy_pass http://159.69.119.223:5000;
proxy_pass https://127.0.0.1:5000;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /web/dd_flask;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment