-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
executable file
·98 lines (88 loc) · 2.46 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
##
# Club Penguin Continued Gateway
##
##
# WebSocket Configuration
##
upstream cpcontinued_wsgw_login {
server 127.0.0.1:5110;
}
upstream cpcontinued_wsgw_redemption {
server 127.0.0.1:5111;
}
upstream cpcontinued_wsgw_server_blizzard {
server 127.0.0.1:5112;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
##
# HTTP Listener
##
server {
listen 80;
server_name gateway.cpcontinued.local;
access_log off;
error_log off;
return 301 https://$server_name$request_uri;
}
##
# HTTPS Listener
##
server {
listen 443 ssl;
server_name gateway.cpcontinued.local;
ssl_session_timeout 5m;
ssl_certificate /etc/nginx/certs/localhost.cert;
ssl_certificate_key /etc/nginx/certs/localhost.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log off;
error_log off;
root /var/www/cpcontinued_gateway/public;
index index.html;
error_page 400 =400 /bad_request.html;
error_page 404 /not_found.html;
error_page 502 /bad_gateway.html;
error_page 503 /service_unavailable.html;
error_page 504 /gateway_timeout.html;
# Handle WebSocket endpoint
location /login {
add_header Gateway "CPContinued Login #$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://cpcontinued_wsgw_login;
}
location /redemption {
add_header Gateway "CPContinued Redemption #$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://cpcontinued_wsgw_redemption;
}
location ~ ^\/server\/([a-zA-Z0-9_-]*)$ {
add_header Gateway "CPContinued Server $1";
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 120s;
proxy_send_timeout 120s;
proxy_pass http://cpcontinued_wsgw_server_$1;
}
# Root page
location / {
# Try filename, try directory
try_files $uri $uri/ =404;
}
}