blob: 4aed161b0ad616746b86ffe0d042647ba2781cc5 (
plain)
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
|
server {
listen 81;
listen [::]:81;
server_name fs-react-app.dev.ceit.pdn.ac.lk ;
root /home/ceit_fs_react_app/public_web;
index index.html;
access_log /var/log/nginx/fs-react-app.dev.ceit.pdn.ac.lk_access.log;
error_log /var/log/nginx/fs-react-app.dev.ceit.pdn.ac.lk_error.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying /index.html
try_files $uri $uri/ /index.html;
}
location /.well-known/ {
alias /home/ceit_fs_react_app/well-known/;
}
location /.well-known/acme-challenge {
alias /var/lib/letsencrypt/.well-known/acme-challenge/;
}
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\.(?!well-known).* {
return 403;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name fs-react-app.dev.ceit.pdn.ac.lk ;
root /home/ceit_fs_react_app/public_web;
index index.html;
# Forward requests to API gateway
location /bff/ {
proxy_pass http://127.0.0.1:8050/;
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;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Host $host;
}
# Serve React application files
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying /index.html
try_files $uri $uri/ /index.html;
}
#
# To create a self signed certificate, run the below command
#
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.crt
#
# Or non-intractively
#
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=AB/ST=ABC/L=ABCD/O=ABCDE/CN=fs-react-app.dev.ceit.pdn.ac.lk" -keyout /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.crt
ssl_certificate /etc/letsencrypt/live/fs-react-app.dev.ceit.pdn.ac.lk/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/fs-react-app.dev.ceit.pdn.ac.lk/privkey.pem; # managed by Certbot
ssl_dhparam /etc/nginx/ssl/dhparams.pem;
}
|