-
Notifications
You must be signed in to change notification settings - Fork 0
/
aswwu.conf
166 lines (141 loc) · 3.73 KB
/
aswwu.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
##############################
### PYTHON SERVER BACKENDS ###
##############################
upstream python_backends {
server 127.0.0.1:8881;
server 127.0.0.1:8882;
server 127.0.0.1:8883;
server 127.0.0.1:8884;
}
###############################
### IMAGE RESIZER AND CACHE ###
###############################
server {
listen 8010;
server_name 127.0.0.1;
# dynamic image resizer
location ~ "^/media/(?<width>\d+)/(?<image>.+)$" {
alias /data/media/$image;
image_filter resize $width -;
image_filter_jpeg_quality 75;
image_filter_buffer 8M;
}
}
##############
### CACHES ###
##############
# general cache
proxy_cache_path /tmp/nginx-general-cache/ levels=1:2 keys_zone=general_cache:10m inactive=60m max_size=100m;
# image cache
proxy_cache_path /tmp/nginx-images-cache/ levels=1:2 keys_zone=images:10m inactive=24h max_size=500m;
############
### HTTP ###
############
server {
listen 80;
server_name aswwu.com www.aswwu.com;
return 301 https://$host$request_uri;
}
#############
### HTTPS ###
#############
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/aswwu.com-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aswwu.com-0001/privkey.pem; # managed by Certbot
root /var/www/html;
index index.php index.html;
server_name aswwu.com www.aswwu.com;
#####################
### ANGULAR SITES ###
#####################
location /uploads {
alias /data/uploads;
}
# homepage
location / {
root /var/www/html/homepage/prod;
try_files $uri $uri/ /index.html;
}
# mask
location /mask {
alias /var/www/html/mask/prod;
try_files $uri $uri/ /mask/index.html;
}
# pages
location /pages {
alias /var/www/html/pages/prod;
try_files $uri $uri/ /pages/index.html;
}
# elections
location /elections {
alias /var/www/html/elections/prod;
try_files $uri $uri/ /elections/index.html;
}
# jobs
location /jobs {
alias /var/www/html/jobs/prod;
try_files $uri $uri/ /jobs/index.html;
}
####################
### STATIC SITES ###
####################
# atlas
location /atlas {
alias /var/www/html/atlas/prod;
}
location /concert {
alias /var/www/html/concert/prod;
}
###########################
### TEMPORARY REDIRECTS ###
###########################
location /fund {
return 302 https://aswwu.com/pages/ltpf1920;
}
location /atlas-booking {
return 302 https://wwuform.formstack.com/forms/atlas_booking;
}
###########################
### PERMANENT REDIRECTS ###
###########################
# vote
location /vote {
rewrite ^/vote$ /elections permanent;
}
##################
### MEDIA URLS ###
##################
# image resizer defaults
location /media/img {
rewrite ^/media/img-xs/([A-Za-z0-9/_\s%-\.]+) /media/50/$1;
rewrite ^/media/img-sm/([A-Za-z0-9/_\s%-\.]+) /media/400/$1;
rewrite ^/media/img-md/([A-Za-z0-9/_\s%-\.]+) /media/1024/$1;
rewrite ^/media/img-lg/([A-Za-z0-9/_\s%-\.]+) /media/1920/$1;
}
# intermediate connection to the image resizer
location ~ "^/media/(?<width>(50|400|1024|1920))/(?<image>.+)$" {
proxy_pass http://127.0.0.1:8010/media/$width/$image;
proxy_cache images;
proxy_cache_valid 200 24h;
}
# original images
location /media {
alias /data/media;
}
#####################
### PYTHON SERVER ###
#####################
location /server/ {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_cache general_cache;
add_header X-Proxy-Cache $upstream_cache_status;
include proxy_params;
proxy_pass http://python_backends/;
}
}