fix: Errors with service and nginx
This commit is contained in:
parent
70ab871e63
commit
2f75f3d641
19
README.md
19
README.md
@ -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
|
||||
```
|
10
install.sh
10
install.sh
@ -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
|
||||
|
@ -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
|
6
sites.py
6
sites.py
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user