-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.nginx
191 lines (176 loc) · 4.8 KB
/
config.nginx
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
##
# R&C Website, REST API services, and websocket gateway services
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
##
# Upstream servers
##
upstream clank_uya_web {
server 10.0.0.18:8200;
}
upstream clank_dl_web {
server 10.0.0.18:8201;
}
upstream clank_uya_api {
server 10.0.0.18:8280;
}
upstream clank_dl_api {
server 10.0.0.18:8281;
}
upstream clank_uya_dmewsc {
server 10.0.0.18:8686;
}
upstream clank_dl_dmewsc {
server 10.0.0.18:8687;
}
##
# HTTP Listener
##
server {
listen 80;
server_name uya.raconline.gg dl.raconline.gg raconline.gg;
access_log off;
error_log off;
return 301 https://$server_name$request_uri;
}
server {
listen 80;
server_name uyaonline.com;
access_log off;
error_log off;
return 301 https://raconline.com$request_uri;
}
server {
listen 443 ssl;
server_name uyaonline.com;
ssl_session_timeout 5m;
ssl_certificate /etc/nginx/certs/raconline.gg.cert;
ssl_certificate_key /etc/nginx/certs/raconline.gg.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log off;
error_log off;
return 301 https://raconline.com$request_uri;
}
##
# HTTPS Listener for raconline.com
##
server {
listen 443 ssl;
server_name raconline.gg;
ssl_session_timeout 5m;
ssl_certificate /etc/nginx/certs/raconline.gg.cert;
ssl_certificate_key /etc/nginx/certs/raconline.gg.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log off;
error_log off;
root /var/www/raconline.gg/public;
index index.html index.php;
# PHP website
location / {
try_files $uri $uri/ /index.php?/$request_uri;
location = /index.php {
fastcgi_index index.php;
fastcgi_send_timeout 30;
fastcgi_read_timeout 30;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param CI_ENV "production";
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
include fastcgi_params;
}
}
}
##
# HTTPS Listener for uya.raconline.com
##
server {
listen 443 ssl;
server_name uya.raconline.gg;
ssl_session_timeout 5m;
ssl_certificate /etc/nginx/certs/raconline.gg.cert;
ssl_certificate_key /etc/nginx/certs/raconline.gg.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log off;
error_log off;
index index.html index.php;
# API handler
location /api {
add_header Gateway "Clank UYA API #$connection";
proxy_intercept_errors on;
proxy_http_version 1.1;
proxy_connect_timeout 8s;
proxy_read_timeout 5s;
proxy_send_timeout 5s;
proxy_pass http://clank_uya_api;
}
# WebSocket endpoint
location /api/dmewsc {
add_header Gateway "Clank UYA DME WSC #$connection";
proxy_intercept_errors on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_connect_timeout 8s;
proxy_read_timeout 5s;
proxy_send_timeout 5s;
proxy_pass http://clank_uya_dmewsc;
}
# Forward to website
location / {
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_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://clank_uya_web;
}
}
##
# HTTPS Listener for dl.raconline.com
##
server {
listen 443 ssl;
server_name dl.raconline.gg;
ssl_session_timeout 5m;
ssl_certificate /etc/nginx/certs/raconline.gg.cert;
ssl_certificate_key /etc/nginx/certs/raconline.gg.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log off;
error_log off;
index index.html index.php;
# API handler
location /api {
add_header Gateway "Clank DL API #$connection";
proxy_intercept_errors on;
proxy_http_version 1.1;
proxy_connect_timeout 8s;
proxy_read_timeout 5s;
proxy_send_timeout 5s;
proxy_pass http://clank_dl_api;
}
# WebSocket endpoint
location /api/dmewsc {
add_header Gateway "Clank DL DME WSC #$connection";
proxy_intercept_errors on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_connect_timeout 8s;
proxy_read_timeout 5s;
proxy_send_timeout 5s;
proxy_pass http://clank_dl_dmewsc;
}
# Forward to website
location / {
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_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://clank_dl_web;
}
}