Skip to content

Instantly share code, notes, and snippets.

@cosven
Last active August 22, 2018 13:56
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 cosven/e308359b83df5cbbe7398b4a95247add to your computer and use it in GitHub Desktop.
Save cosven/e308359b83df5cbbe7398b4a95247add to your computer and use it in GitHub Desktop.
Django 项目部署示例
server {
listen 80;
server_name cosven.me www.cosven.me;
# path for static files
location /static/ {
root /data/static;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://0.0.0.0:8000;
}
}
[program:web]
command = /data/venvs/web/bin/gunicorn -b :8000 -w 4 web.wsgi --log-file -
directory = /data/xxx
environment = DEBUG="1",NAME="2"
autostart = true
autorestart = true
loglevel = info
stdout_logfile = /data/log/supervisor/web-stdout.log
stderr_logfile = /data/log/supervisor/web-stderr.log
stdout_logfile_maxbytes = 500MB
stdout_logfile_backups = 50
stdout_capture_maxbytes = 1MB
stdout_events_enabled = false
@cosven
Copy link
Author

cosven commented Aug 22, 2018

  1. nginx.conf 是 Nginx 配置文件(一般放到 nginx 的 sites-enabled/ 目录下)
  2. web.conf 是进程的 supervisor 配置文件()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment