-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
78 lines (66 loc) · 2.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
# 전역 설정
user nginx;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
# http 블록 시작
http {
# upstream 지시어 설정
upstream back {
server backend:8000;
}
# 서버 블록 시작
server {
listen 80;
server_name ainterview.site;
charset utf-8;
# Allow only for register SSL (Certbot)
location /.well-known/acme-challenge/ {
allow all;
root /var/www/certbot;
}
# Http로 들어온 요청을 Https로 Redirect
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name ainterview.site;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/ainterview.site-0001/fullchain.pem; # ssl 인증서 사용
ssl_certificate_key /etc/letsencrypt/live/ainterview.site-0001/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# ignore cache frontend
location ~* (service-worker\.js)$ {
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
proxy_no_cache 1;
}
location /api/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
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_pass http://back;
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://back;
}
location / {
root /var/www/frontend;
try_files $uri $uri/ /index.html?q=$uri&$args;
}
}
}