-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
92 lines (78 loc) · 3.1 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
# This allows nginx to front-end the docker compose setup. That relies on localhost
# domain names, but we can use the nginx sub module to rewrite those.
map $server_port $app {
443 freegle;
444 modtools;
}
server {
server_name staging.ilovefreegle.org;
# Turn off compression to make sub_filter work.
gzip_static off;
location / {
if ($app = "freegle") {
proxy_pass http://freegle.localhost;
}
if ($app = "modtools") {
proxy_pass http://modtools.localhost;
}
proxy_set_header Host $app.localhost;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /apiv1/ {
proxy_pass http://apiv1.localhost:81/;
proxy_set_header Accept-Encoding "";
proxy_set_header Host apiv1.localhost;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /apiv2 {
proxy_pass http://apiv2.localhost:8192;
proxy_set_header Accept-Encoding "";
proxy_set_header Host apiv2.localhost;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /modtools {
proxy_pass http://modtools.localhost;
proxy_set_header Host modtools.localhost;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /phpmyadmin/ {
proxy_pass http://phpmyadmin.localhost/;
proxy_set_header Host phpmyadmin.localhost;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /mailhog/ {
proxy_pass http://mailhog.localhost/;
proxy_set_header Host mailhog.localhost;
proxy_set_header X-Forwarded-For $remote_addr;
}
sub_filter_once off;
sub_filter_types text/html application/json;
sub_filter 'freegle.localhost' 'staging.ilovefreegle.org';
sub_filter 'modtools.localhost' 'staging.ilovefreegle.org:444';
sub_filter 'phpmyadmin.localhost' 'staging.ilovefreegle.org/phpmyadmin';
sub_filter 'mailhog.localhost' 'staging.ilovefreegle.org/mailhog';
sub_filter 'apiv1.localhost' 'staging.ilovefreegle.org/apiv1';
sub_filter 'apiv2.localhost:8192/api' 'staging.ilovefreegle.org/apiv2';
sub_filter 'http://' 'https://';
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen [::]:444 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
listen 444 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/staging.ilovefreegle.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/staging.ilovefreegle.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# When renewing the SSL certificate:
# docker compose stop
# comment in the lines below
# /etc/init.d/nginx reload
# /usr/bin/certbot renew
# comment out the lines below
# /etc/init.d/nginx reload
# docker compose up -d
#server {
#server_name staging.ilovefreegle.org;
#listen 80;
#root /var/www;
#}