Skip to content

Instantly share code, notes, and snippets.

@AnvilFox1965
Forked from jsutlovic/nginx.conf
Created June 22, 2022 17:21
Show Gist options
  • Save AnvilFox1965/441f6630a7b10f201a88d7903eeeb938 to your computer and use it in GitHub Desktop.
Save AnvilFox1965/441f6630a7b10f201a88d7903eeeb938 to your computer and use it in GitHub Desktop.
nginx + uwsgi local configs
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream uwsgi_server {
server localhost:8083;
}
upstream dev_server {
server localhost:8000;
}
upstream sentry_server {
server localhost:9000;
}
server {
listen 80;
server_name dev.jero.tophatmonocle.com;
return 302 https://dev.jero.tophatmonocle.com$request_uri;
}
server {
listen 80;
server_name jero.tophatmonocle.com;
return 302 https://jero.tophatmonocle.com$request_uri;
}
server {
listen 443 ssl;
server_name jero.tophatmonocle.com;
ssl_certificate /usr/local/etc/nginx/ssl/jero.tophatmonocle.com.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/jero.tophatmonocle.com.nopass.key;
root /Users/jero/dev/thm_env/THM;
location /favicon.ico {
alias /Users/jero/dev/thm_env/THM/media/icon.ico;
}
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
uwsgi_pass uwsgi_server;
include uwsgi_params;
}
}
server {
listen 443 ssl;
server_name dev.jero.tophatmonocle.com;
ssl_certificate /usr/local/etc/nginx/ssl/wc.jero.tophatmonocle.com.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/jero.tophatmonocle.com.nopass.key;
root /Users/jero/dev/thm_env/THM;
location / {
try_files $uri @proxy_to_app;
}
location /favicon.ico {
alias /Users/jero/dev/thm_env/THM/media/icon.ico;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_read_timeout 6000;
proxy_redirect off;
proxy_pass http://dev_server;
}
}
server {
listen 80;
server_name sentry.jero.tophatmonocle.com;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_read_timeout 60;
proxy_redirect off;
proxy_pass http://sentry_server;
}
}
}
[uwsgi]
chdir=/Users/jero/dev/thm_env/THM
module=wsgi:application
pp=/Users/jero/dev/thm_env
master=True
pidfile=/tmp/uwsgi-thm.pid
socket=127.0.0.1:8083
processes=1
limit-as=128
vacuum=True
max-requests=5000
home=/Users/jero/dev/thm_env
debug=True
need-app=True
single-interpreter=True
touch-reload=/Users/jero/dev/thm_env/THM
import sys
import os
from django.core.handlers.wsgi import WSGIHandler
# If using virtualenvs
import site
envpath = "/Users/jero/dev/thm_env/lib/python2.7/site-packages"
site.addsitedir(envpath)
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'THM'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
application = WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment