-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastrobin.com.nginx
214 lines (176 loc) · 6.22 KB
/
astrobin.com.nginx
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
upstream app_server {
server 127.0.0.1:8082 fail_timeout=0;
}
server {
listen 80;
server_name astrob.in;
rewrite ^/(.*) http://www.astrobin.com/$1 permanent;
}
server {
listen 80;
server_name www.astrob.in;
rewrite ^/(.*) http://www.astrobin.com/$1 permanent;
}
server {
listen 80;
server_name q.astrob.in;
rewrite ^/(\d+)/?$ http://questions.astrobin.com/question/$1 permanent;
rewrite ^/(.*) http://questions.astrobin.com/$1 permanent;
}
server {
listen 80;
server_name trns.astrob.in;
rewrite ^/(.*) http://translate.astrobin.com/$1 permanent;
}
server {
listen 80;
server_name astrobin.com;
rewrite ^/(.*) http://www.astrobin.com/$1 permanent;
}
server {
listen 80 default;
listen 443 default ssl;
client_max_body_size 4G;
server_name www.astrobin.com;
error_page 502 503 /media/static/html/502.html;
rewrite ^/notices/$ /notifications permanent;
access_log /var/log/nginx/astrobin.com-access.log;
error_log /var/log/nginx/astrobin.com-error.log;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
keepalive_timeout 5;
proxy_read_timeout 1200;
## Compression
# src: http://www.ruby-forum.com/topic/141251
# src: http://wiki.brightbox.co.uk/docs:nginx
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Some version of IE 6 don't handle compression well on some mime-types, so just disable for them
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Set a vary header so downstream proxies don't send cached gzipped content to IE6
gzip_vary on;
## /Compression
location /media/ {
root /var/www;
expires 30d;
}
location /tmpzips/ {
root /var/www;
expires 3d;
}
location / {
if ($request_uri ~* "^/robots.txt") {
rewrite ^/robots.txt /media/static/robots.txt permanent;
}
proxy_no_cache $http_pragma $http_authorization;
proxy_cache_bypass $http_pragma $http_authorization;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header HTTP_AUTHORIZATION $http_authorization;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
location /favicon.ico {
root /media/static;
expires max;
}
# internal publish endpoint (keep it private / protected)
#location /publish {
# set $push_channel_id $arg_id; #/?id=239aff3 or somesuch
# push_publisher;
#
# push_store_messages off; # disable message queueing
# push_message_timeout 0; # never expire buffer messages
# push_message_buffer_length 0; # don't store messages
# #push_min_message_recipients 0; # minimum recipients before purge
#}
# public long-polling endpoint
#location /activity {
# push_subscriber;
#
# how multiple listener requests to the same channel id are handled
# - last: only the most recent listener request is kept, 409 for others.
# - first: only the oldest listener request is kept, 409 for others.
# - broadcast: any number of listener requests may be long-polling.
# push_subscriber_concurrency first;
# set $push_channel_id $arg_id;
# default_type text/plain;
#}
}
server {
server_name translate.astrobin.com;
root /home/astrobin/venv/translate.astrobin.com/lib/python2.7/site-packages/pootle;
location ^~ /assets/ {
root /home/astrobin/venv/translate.astrobin.com/lib/python2.7/site-packages/pootle;
expires 30d;
}
location / {
fastcgi_pass 127.0.0.1:8084;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
fastcgi_read_timeout 1200;
}
}
upstream questions_app_server {
server 127.0.0.1:8083 fail_timeout=0;
}
server {
client_max_body_size 2M;
server_name questions.astrobin.com;
access_log /var/log/nginx/questions.astrobin.com-access.log;
error_log /var/log/nginx/questions.astrobin.com-error.log;
keepalive_timeout 10;
proxy_read_timeout 300;
## Compression
# src: http://www.ruby-forum.com/topic/141251
# src: http://wiki.brightbox.co.uk/docs:nginx
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Some version of IE 6 don't handle compression well on some mime-types, so just disable for them
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Set a vary header so downstream proxies don't send cached gzipped content to IE6
gzip_vary on;
## /Compression
location /static/ {
root /webserver/questions;
expires 30d;
}
location / {
if ($request_uri ~* "^/robots.txt") {
rewrite ^/robots.txt /static/robots.txt permanent;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://questions_app_server;
break;
}
}
}