-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathmy_nginx.conf
65 lines (49 loc) · 1.78 KB
/
my_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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# the upstream component nginx needs to connect to
upstream uwsgi {
# server api:8001; # use TCP
server unix:/docker_api/app.sock; # for a file socket
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# index index.html;
# the domain name it will serve for
# substitute your machine's IP address or FQDN
server_name twtrubiks.com www.twtrubiks.com;
charset utf-8;
client_max_body_size 75M; # adjust to taste
# Django media
# location /media {
# alias /docker_api/static/media; # your Django project's media files - amend as required
# }
location /static {
alias /docker_api/static; # your Django project's static files - amend as required
}
location /nginx/status {
# 啟用 stub_status
stub_status on;
# 關閉/啟用 log
# access_log /usr/local/nginx/logs/status.log;
access_log off;
auth_basic "NginxStatus";
auth_basic_user_file /my_htpasswd/htpasswd;
# 限制可存取的 IP
# allow 127.0.0.1;
# deny all;
}
location / {
# 限制可存取的 IP
# allow 127.0.0.1;
# deny all;
uwsgi_pass uwsgi;
# nginx CORS
# nginx+uwssgi issuse
# https://github.com/unbit/uwsgi/issues/1550
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
# add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
}
}