stuff/puffer.sh
2024-09-06 06:03:01 -04:00

43 lines
No EOL
1.3 KiB
Bash

#!/bin/bash
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root. Please use 'sudo' or switch to the root user."
exit 1
fi
read -p "Enter your domain name (e.g., panel.example.com): " domain
curl -s https://packagecloud.io/install/repositories/pufferpanel/pufferpanel/script.deb.sh | bash &
wait
apt-get install pufferpanel -y
pufferpanel user add
systemctl enable --now pufferpanel
apt-get update
apt-get install nginx
cat <<EOL > "/etc/nginx/sites-enabled/pufferpanel.conf"
server {
listen 80;
root /var/www/pufferpanel;
server_name $domain;
location ~ ^/\\.well-known {
root /var/www/html;
allow all;
}
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Nginx-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
client_max_body_size 100M;
}
}
EOL
systemctl restart nginx
apt-get update
apt-get install certbot python3-certbot-nginx -y
certbot --nginx -d $domain
echo "pufferpanel installed, you should be able to reach it at https://$domain, and login with the admin user you specified earlier"