diff --git a/check-website.sh b/check-website.sh index 673ede8..e343929 100755 --- a/check-website.sh +++ b/check-website.sh @@ -1,17 +1,33 @@ #!/bin/bash -# This script checks the status of the portfolio website +# This script checks the status of all services on boilerhaus.org -echo "Checking website status..." +echo "=== Checking Services Status ===" + +echo -e "\n1. Portfolio Website (boilerhaus.org)" +echo "--------------------------------" curl -I https://boilerhaus.org +echo -e "\nStatus: $(curl -s -o /dev/null -w "%{http_code}" https://boilerhaus.org)" -echo -e "\nChecking Gitea status..." +echo -e "\n2. Gitea (git.boilerhaus.org)" +echo "--------------------------------" curl -I https://git.boilerhaus.org +echo -e "\nStatus: $(curl -s -o /dev/null -w "%{http_code}" https://git.boilerhaus.org)" -echo -e "\nChecking Vaultwarden status..." -curl -I https://bw.boilerhaus.org - -echo -e "\nChecking Nextcloud status..." +echo -e "\n3. Nextcloud (cloud.boilerhaus.org)" +echo "--------------------------------" curl -I https://cloud.boilerhaus.org +echo -e "\nStatus: $(curl -s -o /dev/null -w "%{http_code}" https://cloud.boilerhaus.org)" -echo -e "\nAll checks completed." \ No newline at end of file +echo -e "\n4. Vaultwarden (bw.boilerhaus.org)" +echo "--------------------------------" +curl -I https://bw.boilerhaus.org +echo -e "\nStatus: $(curl -s -o /dev/null -w "%{http_code}" https://bw.boilerhaus.org)" + +echo -e "\n=== Service Configuration Summary ===" +echo "Portfolio: Port 443 (HTTPS) → /var/www/boilerhaus.org" +echo "Gitea: Port 8080 → http://localhost:8080" +echo "Nextcloud: Port 8081 → http://localhost:8081" +echo "Vaultwarden: Port 8222 → http://localhost:8222" + +echo -e "\n=== All checks completed ===" \ No newline at end of file diff --git a/fix-nginx-config.sh b/fix-nginx-config.sh new file mode 100755 index 0000000..61e7d0a --- /dev/null +++ b/fix-nginx-config.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +# This script fixes the Nginx configuration + +# Load environment variables +if [ -f .env ]; then + source .env +else + echo "Error: .env file not found. Please create it based on .env.example." + exit 1 +fi + +# Check if sshpass is installed +if ! command -v sshpass &> /dev/null; then + echo "Error: sshpass is not installed. Please run 'sudo apt-get install sshpass' first." + exit 1 +fi + +# Set SSH command with password +SSH_CMD="sshpass -p $SERVER_PASSWORD ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP" + +echo "Fixing Nginx configuration..." + +# Create a temporary file with the complete configuration +cat > nginx-fix.conf << 'EOF' +server { + server_name boilerhaus.org; + + root /var/www/boilerhaus.org; + index index.html; + + location / { + try_files $uri $uri/ =404; + } + + # Managed by Certbot + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/boilerhaus.org-0001/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/boilerhaus.org-0001/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot +} + +# Nextcloud configuration +server { + server_name cloud.boilerhaus.org; + + # Proxy to Nextcloud + location / { + proxy_pass http://localhost:8081; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Increase timeout for long-running operations + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + send_timeout 600; + + # WebDAV support + client_max_body_size 512M; + + # Enable WebSocket support + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + # Managed by Certbot + listen [::]:443 ssl; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/boilerhaus.org-0001/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/boilerhaus.org-0001/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot +} + +server { + if ($host = boilerhaus.org) { + return 301 https://$host$request_uri; + } # managed by Certbot + + listen 80; + listen [::]:80; + server_name boilerhaus.org; + return 404; # managed by Certbot +} + +server { + if ($host = cloud.boilerhaus.org) { + return 301 https://$host$request_uri; + } # managed by Certbot + + listen 80; + listen [::]:80; + server_name cloud.boilerhaus.org; + return 404; # managed by Certbot +} +EOF + +# Upload the temporary file to the server +sshpass -p "$SERVER_PASSWORD" scp -o StrictHostKeyChecking=no nginx-fix.conf $SERVER_USER@$SERVER_IP:/tmp/ + +# Backup the current configuration +$SSH_CMD "sudo cp /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-available/boilerhaus.org.conf.bak.$(date +%s)" + +# Replace the configuration +$SSH_CMD "sudo cp /tmp/nginx-fix.conf /etc/nginx/sites-available/boilerhaus.org.conf" + +# Test the Nginx configuration +$SSH_CMD "sudo nginx -t" + +# Reload Nginx if the configuration is valid +$SSH_CMD "sudo systemctl reload nginx || sudo systemctl restart nginx" + +# Clean up +rm nginx-fix.conf + +echo "Nginx configuration fixed! cloud.boilerhaus.org should now point to your Nextcloud instance." \ No newline at end of file