asgi + daphne
This commit is contained in:
parent
6f4282d96e
commit
9bf24b072b
7 changed files with 76 additions and 31 deletions
|
|
@ -1,34 +1,42 @@
|
|||
upstream django {
|
||||
server web:8000;
|
||||
}
|
||||
events {}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# Static files
|
||||
location /static/ {
|
||||
alias /app/static/;
|
||||
expires 1y;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
gzip_static on;
|
||||
http {
|
||||
upstream django {
|
||||
server web:8000;
|
||||
}
|
||||
|
||||
# Media files
|
||||
location /media/ {
|
||||
alias /app/media/;
|
||||
expires 7d;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# Django app
|
||||
location / {
|
||||
proxy_pass http://django;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# Static files
|
||||
location /static/ {
|
||||
alias /app/static/;
|
||||
expires 1y;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
gzip_static on;
|
||||
}
|
||||
|
||||
# Media files
|
||||
location /media/ {
|
||||
alias /app/media/;
|
||||
expires 7d;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
# Django app
|
||||
location / {
|
||||
proxy_pass http://django;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue