init
This commit is contained in:
60
nginx/nginx.conf
Normal file
60
nginx/nginx.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
# nginx.conf
|
||||
|
||||
user nginx;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 5s;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" $status '
|
||||
'$body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
upstream app {
|
||||
server app:8000;
|
||||
}
|
||||
|
||||
upstream api {
|
||||
server api:8000;
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
listen 8000;
|
||||
charset utf-8;
|
||||
|
||||
server_name _;
|
||||
|
||||
location /static/ {
|
||||
autoindex on;
|
||||
alias /var/www/app/static/;
|
||||
}
|
||||
|
||||
location /django/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host app;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
proxy_pass http://app;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host app;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
proxy_pass http://api;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user