forked from boostcampwm-2024/web03-CorinEE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
64 lines (53 loc) · 2.29 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
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
upstream api_servers {
#least_conn;
server corinee_server_1:3000 weight=4 max_fails=3 fail_timeout=30s;
# server 223.130.134.167:3000 weight=8 max_fails=3 fail_timeout=30s;
# server 223.130.130.192:3000 weight=8 max_fails=3 fail_timeout=30s;
# server 211.188.59.137:3000 weight=8 max_fails=3 fail_timeout=30s;
keepalive 300;
keepalive_requests 1000;
keepalive_timeout 75s;
}
server {
listen 80;
listen 443 ssl;
server_name corinee.site www.corinee.site;
ssl_certificate /etc/letsencrypt/live/corinee.site/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/corinee.site/privkey.pem;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://api_servers;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
proxy_next_upstream_tries 3;
proxy_next_upstream_timeout 10s;
proxy_connect_timeout 10s;
proxy_send_timeout 10s;
proxy_read_timeout 10s;
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_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 Origin $http_origin;
proxy_set_header X-Server-Id $upstream_addr;
add_header X-Served-By $upstream_addr;
add_header 'Access-Control-Allow-Origin' 'https://www.corinee.site' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
}
}