-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
105 lines (88 loc) · 3.19 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
93
94
95
96
97
98
99
100
101
102
103
104
105
server {
listen 80;
listen [::]:80;
root /var/www/html/readium/ereader;
server_name thynk.balashan.dev www.thynk.balashan.dev;
location /favicon.ico {
proxy_pass http://localhost:3001;
root /var/www/html/readium/ereader/public;
}
location /img/ {
proxy_pass http://localhost:3001;
root /var/www/html/readium/ereader;
}
location /api/ {
proxy_pass http://localhost:3001;
root /var/www/html/readium/ereader;
}
location /public/ {
proxy_pass http://localhost:3001;
root /var/www/html/readium/ereader;
}
location /app/ {
proxy_pass http://localhost:3001;
root /var/www/html/readium/ereader;
}
location /api/upload/ {
proxy_pass http://localhost:3001/api/upload/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /uploads/ {
proxy_pass http://localhost:3001/uploads/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /reader/ {
proxy_pass http://localhost:3001/reader/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^/_next/static {
alias /var/www/html/readium/ereader/app/$1;
}
location / {
proxy_pass http://localhost:3001;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
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_cache_bypass $http_upgrade;
gzip on;
gzip_comp_level 4;
gzip_types text/plain application/xml application/json application/javascript;
# Important for Next.js routing
try_files $uri $uri/ /_next/static/index.html;
}
location ^~ /_next/static/ {
root /var/www/html/readium/ereader/.next;
proxy_pass http://localhost:3001;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
}
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/thynk.balashan.dev/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/thynk.balashan.dev/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
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline' 'unsafe-eval'" always;
# Maximum upload size
client_max_body_size 50M;
# Buffer size settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
server {
if ($host = thynk.balashan.dev) {
return 301 https://$host$request_uri;
}
}