Split websocket stuff in separate .conf for Nginx

This commit is contained in:
DeathByDenim 2022-02-18 19:00:02 -05:00
parent ecc2874033
commit f11d151924
Signed by: DeathByDenim
GPG Key ID: 4A475283D925365B
6 changed files with 48 additions and 28 deletions

View File

@ -62,6 +62,10 @@ else
fi
cp console2web/console2web.py /usr/bin/console2web
# Deploy web interface stuff
"$(dirname "$0")"/scripts/deploy_monitoring.sh
"$(dirname "$0")"/scripts/deploy_webserver.sh
# Deploy the game servers
"$(dirname "$0")"/scripts/deploy_supertuxkart.sh
"$(dirname "$0")"/scripts/deploy_bzflag.sh
@ -75,9 +79,5 @@ cp console2web/console2web.py /usr/bin/console2web
"$(dirname "$0")"/scripts/deploy_xonotic.sh
"$(dirname "$0")"/scripts/deploy_armagetron_advanced.sh
# Deploy web interface stuff
"$(dirname "$0")"/scripts/deploy_monitoring.sh
"$(dirname "$0")"/scripts/deploy_webserver.sh
echo
echo "Installation complete. Password is ${systempassword}"

View File

@ -26,5 +26,15 @@ EOF
systemctl restart armagetronad-dedicated.service
cat > /etc/nginx/gameserver.d/armagetronad.conf <<EOF
location /armagetronad {
proxy_pass http://localhost:62551/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
}
EOF
# Add firewall rules
firewall-cmd --zone=public --add-port=4534/udp --permanent

View File

@ -29,5 +29,15 @@ EOF
systemctl daemon-reload
systemctl enable --now mindustry.service
cat > /etc/nginx/gameserver.d/mindustry.conf <<EOF
location /mindustry {
proxy_pass http://localhost:62548/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
}
EOF
firewall-cmd --zone=public --add-port=6567/tcp --permanent
firewall-cmd --zone=public --add-port=6567/udp --permanent

View File

@ -51,4 +51,14 @@ EOF
systemctl daemon-reload
systemctl enable --now unvanquished.service
cat > /etc/nginx/gameserver.d/unvanquished.conf <<EOF
location /unvanquished {
proxy_pass http://localhost:62549/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
}
EOF
firewall-cmd --zone=public --add-port=27960/udp --permanent

View File

@ -45,7 +45,7 @@ patch --ignore-whitespace /etc/nginx/sites-available/default <<EOF
# Default server configuration
#
server {
@@ -121,6 +126,39 @@
@@ -121,6 +126,17 @@
try_files \$uri \$uri/ =404;
}
@ -54,29 +54,7 @@ patch --ignore-whitespace /etc/nginx/sites-available/default <<EOF
+ auth_basic_user_file /etc/nginx/htpasswd;
+ }
+
+ location /mindustry {
+ proxy_pass http://localhost:62548/;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade \$http_upgrade;
+ proxy_set_header Connection "Upgrade";
+ proxy_set_header Host \$host;
+ }
+
+ location /unvanquished {
+ proxy_pass http://localhost:62549/;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade \$http_upgrade;
+ proxy_set_header Connection "Upgrade";
+ proxy_set_header Host \$host;
+ }
+
+ location /xonotic {
+ proxy_pass http://localhost:62550/;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade \$http_upgrade;
+ proxy_set_header Connection "Upgrade";
+ proxy_set_header Host \$host;
+ }
+ include /etc/nginx/gameserver.d/*.conf;
+
+ location /monitoring/ {
+ proxy_pass http://localhost:9000/;
@ -87,6 +65,8 @@ patch --ignore-whitespace /etc/nginx/sites-available/default <<EOF
#location ~ \\.php\$ {
EOF
mkdir -p /etc/nginx/gameserver.d
# Store password
echo -n "${systemuser}:" > /etc/nginx/htpasswd
echo -e "import bcrypt\nprint(bcrypt.hashpw('${systempassword}'.encode('utf8'),bcrypt.gensalt(rounds=10)).decode('utf8'))" | python3 >> /etc/nginx/htpasswd

View File

@ -55,4 +55,14 @@ EOF
systemctl daemon-reload
systemctl enable --now xonotic.service
cat > /etc/nginx/gameserver.d/xonotic.conf <<EOF
location /xonotic {
proxy_pass http://localhost:62550/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
}
EOF
firewall-cmd --zone=public --add-port=26000/udp --permanent