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
|
# 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
|
# Install nginx
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install nginx -y
|
sudo apt install nginx python3-pip -y
|
||||||
|
|
||||||
cd /root
|
cd /root
|
||||||
git clone https://git.woodburn.au/nathanwoodburn/site-manager.git
|
git clone https://git.woodburn.au/nathanwoodburn/site-manager.git
|
||||||
cd site-manager
|
cd site-manager
|
||||||
chmod +x *.sh
|
chmod +x *.sh
|
||||||
|
python3 -m pip install -r requirements.txt
|
||||||
|
|
||||||
# Install python script as a service
|
# Install python script as a service
|
||||||
sudo cp ./nginx-traffic-monitor.service /etc/systemd/system/nginx-traffic-monitor.service
|
sudo cp ./nginx-manager.service /etc/systemd/system/nginx-manager.service
|
||||||
sudo systemctl start nginx-traffic-monitor]
|
sudo systemctl start nginx-manager
|
||||||
sudo systemctl enable nginx-traffic-monitor
|
sudo systemctl enable nginx-manager
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=NGINX Traffic Monitor
|
Description=NGINX Manager
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
@ -7,8 +7,8 @@ Type=simple
|
|||||||
ExecStart=/usr/bin/python3 /root/site-manager/main.py
|
ExecStart=/usr/bin/python3 /root/site-manager/main.py
|
||||||
WorkingDirectory=/root/site-manager
|
WorkingDirectory=/root/site-manager
|
||||||
Restart=always
|
Restart=always
|
||||||
User=nginx
|
User=root
|
||||||
Group=nginx
|
Group=root
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
6
sites.py
6
sites.py
@ -161,7 +161,7 @@ def write_nginx_conf(site):
|
|||||||
server {{
|
server {{
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
root {location};
|
root '{location}';
|
||||||
index index.html;
|
index index.html;
|
||||||
server_name {domain} *.{domain};
|
server_name {domain} *.{domain};
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ def write_nginx_conf(site):
|
|||||||
server {{
|
server {{
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
root {location};
|
root '{location}';
|
||||||
index index.html;
|
index index.html;
|
||||||
server_name {alt} *.{alt};
|
server_name {alt} *.{alt};
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ def write_nginx_conf(site):
|
|||||||
ssl_certificate_key /root/site-manager/certs/{alt}.key;
|
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)
|
file.write(conf)
|
||||||
|
|
||||||
# Restart nginx
|
# Restart nginx
|
||||||
|
Loading…
Reference in New Issue
Block a user