-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
187 lines (137 loc) · 5.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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#user nobody;
worker_processes 1;
error_log /.jdev/.logs/nginx/error.log;
#error_log /.jdev/.logs/nginx/error.log notice;
#error_log /.jdev/.logs/nginx/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
send_timeout 1800;
sendfile on;
keepalive_timeout 6500;
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 /.jdev/.logs/nginx/access.main.log main;
error_log /.jdev/.logs/nginx/error.main.log;
# Django load Balancer
upstream DjangoApp {
server 127.0.0.1:7001;
server 127.0.0.1:9001;
}
# GZIP SETUP
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
gzip_disable "MSIE [1-6]\.";
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
add_header Strict-Transport-Security "max-age=31536000";
# EMBER APP SERVER
server {
listen 80;
server_name localhost;
access_log /.jdev/.logs/nginx/ember.access.log;
error_log /.jdev/.logs/nginx/ember.error.log;
root /.jdev/sites/ember/redd-frontend/redd/;
return 301 https://$server_name$request_uri;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# DJANGO CLUSTER SERVER
server {
listen 6080 ssl;
server_name localhost;
access_log /.jdev/.logs/nginx/django_cluster.access.log;
error_log /.jdev/.logs/nginx/django_cluster.error.log;
ssl on;
ssl_certificate /.jdev/.ssl_certificate/redd.crt;
ssl_certificate_key /.jdev/.ssl_certificate/redd.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location /static/ {
autoindex on;
alias /.jdev/sites/python/redd-backend/static/;
}
location / {
proxy_pass http://DjangoApp;
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;
}
}
# DJANGO SERVER 1
server {
listen 7080;
server_name localhost;
#charset koi8-r;
access_log /.jdev/.logs/nginx/django1.access.log main;
error_log /.jdev/.logs/nginx/django1.error.log;
root /.jdev/sites/python/redd-backend/;
location /static/ {
autoindex on;
alias /.jdev/sites/python/redd-backend/static/;
}
location / {
proxy_pass http://127.0.0.1:7001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
}
}
# DJANGO SERVER 2
server {
listen 9080;
server_name localhost;
#charset koi8-r;
access_log /.jdev/.logs/nginx/django2.access.log main;
error_log /.jdev/.logs/nginx/django2.error.log;
#root /.jdev/sites/ember/redd-frontend/redd/;
root /.jdev/sites/python/redd-backend/;
location /static/ {
autoindex on;
alias /.jdev/sites/python/redd-backend/static/;
}
location / {
proxy_pass http://127.0.0.1:9001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
}
}
# HTTPS server
server {
listen 443 ssl;
server_name localhost;
ssl on;
ssl_certificate /.jdev/.ssl_certificate/redd.crt;
ssl_certificate_key /.jdev/.ssl_certificate/redd.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
root /.jdev/sites/ember/redd-frontend/redd/;
location / {
try_files $uri $uri/ /index.html?/$request_uri;
}
}
}