-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
32 lines (27 loc) · 1.22 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
server {
listen 80; # 监听80端口
server_name localhost; # 可以是nginx容器所在ip地址或127.0.0.1,不能写宿主机外网ip地址
charset utf-8;
client_max_body_size 10M; # 限制用户上传文件大小
location /static {
# alias /usr/share/nginx/html/static; # 静态资源路径
alias /var/www/html/pages/static_new;
}
location /media {
# alias /usr/share/nginx/html/media; # 媒体资源,用户上传文件路径
alias /var/www/html/pages/upload;
}
location / {
include /etc/nginx/uwsgi_params;
# uwsgi_pass unix:///tmp/uwsgi.sock
uwsgi_pass 127.0.0.1:8000;
uwsgi_read_timeout 600;
uwsgi_connect_timeout 600;
uwsgi_send_timeout 600;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
# proxy_pass http://django; # 使用uwsgi通信,而不是http,所以不使用proxy_pass。
}
}