-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.conf
60 lines (51 loc) · 1.37 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
# nginx.conf - front-end HTTP service
# For Alpine Linux servers, install this file into
# /etc/nginx/conf.d/default.conf
# Nginx documentation: https://nginx.org/en/docs/
add_header Content-Security-Policy "frame-ancestors 'self'";
# One writer, potentially multiple readers-- and let OS scheduler
# facilitate multiprocessing (without Python GIL limitations)
upstream url_shortener_writer_app {
server 127.0.0.1:8000;
#server 127.0.0.1:8001 backup;
}
upstream url_shortener_read_only_app {
server 127.0.0.1:8010;
server 127.0.0.1:8011;
server 127.0.0.1:8012;
server 127.0.0.1:8013;
server 127.0.0.1:8014;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www/html;
# Sequence of `location` configuration is significant:
location = / {
rewrite . /_v1/home.html break;
}
location = /style.css {
rewrite . /_v1/style.css break;
}
location = /_v1/shorten {
proxy_pass http://url_shortener_writer_app;
expires -1d;
break;
}
location /_v1/ {
try_files $uri $uri.html $uri/ =404;
charset utf-8;
}
location = /favicon.ico {
internal; access_log /dev/null; error_log /dev/null; break;
}
location = /robots.txt {
internal; access_log /dev/null; error_log /dev/null; break;
}
location / {
proxy_pass http://url_shortener_read_only_app;
expires -1d;
break;
}
}