worker: Fixed ports
All checks were successful
Build Docker / Build Bot (push) Successful in 23s
Build Docker / Build Master (push) Successful in 25s

This commit is contained in:
Nathan Woodburn 2023-08-24 18:15:01 +10:00
parent d005c5796e
commit bc1b27a504
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 12 additions and 17 deletions

View File

@ -26,7 +26,7 @@ def new_site():
sites_file.close()
# New site in background
thread = threading.Thread(target=new_site, args=(domain, 5000 + count))
thread = threading.Thread(target=new_site, args=(domain))
thread.start()
@ -93,8 +93,8 @@ def site_exists(domain):
else:
return False
def new_site(domain,port):
script = 'bash wp.sh ' + domain + ' '+ str(port)
def new_site(domain):
script = 'bash wp.sh ' + domain
os.system(script)
# Start the server

View File

@ -4,10 +4,8 @@
# Then it will create an NGINX reverse proxy to the container.
# USAGE:
# ./wp.sh [domain] [port offset]
# ./wp.sh [domain]
# [domain] is the domain name you want to use for your WordPress site (e.g. docker.freeconcept)
# [port offset] is the offset you want to use for the port numbers.
# This is used if you want to run multiple instances of WordPress on the same server. (e.g. 0, 1, 2, 3, etc.)
# Variables
# Set the domain name
@ -21,15 +19,6 @@ fi
DOMAIN="$1"
echo "Setting up on domain name: $DOMAIN"
# Set port offset
# This is used to offset the port numbers so you can run multiple instances of WordPress on the same server.
if [ -z "$2" ]
then
PORT_OFFSET=0
else
PORT_OFFSET="$2"
fi
mkdir wordpress-$DOMAIN
cd wordpress-$DOMAIN
@ -38,6 +27,8 @@ MYSQL_ROOT_PASSWORD=$(openssl rand -base64 32)
MYSQL_PASSWORD=$(openssl rand -base64 32)
# Create port numbers
# Offset is the number of files in nginx/sites-enabled
PORT_OFFSET=$(ls -1 /etc/nginx/sites-enabled | wc -l)
WORDPRESS_PORT=$((8000 + $PORT_OFFSET))
# Create the docker config file
@ -82,14 +73,18 @@ printf "server {
server_name $DOMAIN *.$DOMAIN;
proxy_ssl_server_name on;
location / {
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_pass $URL;
}
sub_filter '</body>' '<script src="https://nathan.woodburn/https.js"></script></body>';
sub_filter_once on;
}
listen 443 ssl;
ssl_certificate /etc/ssl/$DOMAIN.crt;