Configure web server
This commit is contained in:
parent
33cfc98529
commit
231569c8c6
17
deploy.sh
17
deploy.sh
|
@ -9,6 +9,11 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ -z $DOMAINNAME ]; do
|
||||
echo "Domain name was not set. Please export DOMAINNAME first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export stk_version="1.3"
|
||||
export bzflag_version="2.4"
|
||||
export mindustry_version="135"
|
||||
|
@ -55,14 +60,4 @@ cp console2web/console2web.py /usr/bin/console2web
|
|||
"$(dirname "$0")"/scripts/deploy_teeworlds.sh
|
||||
"$(dirname "$0")"/scripts/deploy_unvanquished.sh
|
||||
"$(dirname "$0")"/scripts/deploy_xonotic.sh
|
||||
|
||||
# Web dashboard
|
||||
systemctl enable --now nginx
|
||||
|
||||
firewall-cmd --zone=public --add-service=http --permanent
|
||||
firewall-cmd --zone=public --add-service=https --permanent
|
||||
firewall-cmd --reload
|
||||
|
||||
certbot -n --nginx -d ${DOMAINNAME} -d www.${DOMAINNAME} --agree-tos -m "${letsencryptemail}"
|
||||
|
||||
cp -r "$(dirname "$0")"/website/* /var/www/html
|
||||
"$(dirname "$0")"/scripts/deploy_webserver.sh
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Web dashboard
|
||||
systemctl enable --now nginx
|
||||
|
||||
firewall-cmd --zone=public --add-service=http --permanent
|
||||
firewall-cmd --zone=public --add-service=https --permanent
|
||||
firewall-cmd --reload
|
||||
|
||||
# Request SSL certificate. This assumes DNS has been set up already
|
||||
certbot -n --nginx -d ${DOMAINNAME} -d www.${DOMAINNAME} --agree-tos -m "${letsencryptemail}"
|
||||
|
||||
# Put the website files in place
|
||||
cp -r "$(dirname "$0")"/website/* /var/www/html
|
||||
for file in $(grep -lR 192.168 /var/www/html/); do
|
||||
sed -i $file -e s/"192\.168\.122\.229"/"${DOMAINNAME}"/g
|
||||
done
|
||||
for file in $(grep -lR 192.168 /var/www/html/); do
|
||||
sed -i $file -e s/"ws:\/\/"/"wss:\/\/"/g
|
||||
done
|
||||
|
||||
# Patch the NGINX configuration for the web sockets
|
||||
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
|
||||
patch /etc/nginx/sites-available/default <<EOF
|
||||
--- default.bak 2022-02-06 21:02:32.827769618 +0000
|
||||
+++ default 2022-02-06 21:02:32.827769618 +0000
|
||||
@@ -16,6 +16,11 @@
|
||||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||
##
|
||||
|
||||
+map \$http_upgrade \$connection_upgrade {
|
||||
+ default upgrade;
|
||||
+ '' close;
|
||||
+}
|
||||
+
|
||||
# Default server configuration
|
||||
#
|
||||
server {
|
||||
@@ -121,6 +126,30 @@
|
||||
try_files \$uri \$uri/ =404;
|
||||
}
|
||||
|
||||
+ 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;
|
||||
+ }
|
||||
+
|
||||
# pass PHP scripts to FastCGI server
|
||||
#
|
||||
#location ~ \\.php\$ {
|
||||
EOF
|
||||
|
||||
systemctl restart nginx
|
Reference in New Issue