fix: Errors with service and nginx

This commit is contained in:
Nathan Woodburn 2024-02-23 14:42:15 +11:00
parent 70ab871e63
commit 2f75f3d641
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
4 changed files with 30 additions and 11 deletions

View File

@ -1 +1,20 @@
# site-manager
Installation
------------
```bash
wget https://git.woodburn.au/nathanwoodburn/site-manager/raw/branch/main/install.sh
chmod +x install.sh
sudo ./install.sh
```
Create account
--------------
Accounts can only be created by the root user
```bash
sudo -i
cd /root/site-manager
python3 account.py
exit
```

View File

@ -8,15 +8,15 @@ fi
# Install nginx
sudo apt update
sudo apt install nginx -y
sudo apt install nginx python3-pip -y
cd /root
git clone https://git.woodburn.au/nathanwoodburn/site-manager.git
cd site-manager
chmod +x *.sh
python3 -m pip install -r requirements.txt
# Install python script as a service
sudo cp ./nginx-traffic-monitor.service /etc/systemd/system/nginx-traffic-monitor.service
sudo systemctl start nginx-traffic-monitor]
sudo systemctl enable nginx-traffic-monitor
sudo cp ./nginx-manager.service /etc/systemd/system/nginx-manager.service
sudo systemctl start nginx-manager
sudo systemctl enable nginx-manager

View File

@ -1,5 +1,5 @@
[Unit]
Description=NGINX Traffic Monitor
Description=NGINX Manager
After=network.target
[Service]
@ -7,8 +7,8 @@ Type=simple
ExecStart=/usr/bin/python3 /root/site-manager/main.py
WorkingDirectory=/root/site-manager
Restart=always
User=nginx
Group=nginx
User=root
Group=root
[Install]
WantedBy=multi-user.target

View File

@ -161,7 +161,7 @@ def write_nginx_conf(site):
server {{
listen 80;
listen [::]:80;
root {location};
root '{location}';
index index.html;
server_name {domain} *.{domain};
@ -197,7 +197,7 @@ def write_nginx_conf(site):
server {{
listen 80;
listen [::]:80;
root {location};
root '{location}';
index index.html;
server_name {alt} *.{alt};
@ -225,7 +225,7 @@ def write_nginx_conf(site):
ssl_certificate_key /root/site-manager/certs/{alt}.key;
}}
'''
with open(f'/etc/nginx/sites-available/{id}.conf', 'w') as file:
with open(f'/etc/nginx/sites-enabled/{id}.conf', 'w') as file:
file.write(conf)
# Restart nginx