change_code/help/nginx/start.sh

56 lines
1.4 KiB
Bash

#!/bin/bash
NGINX_BIN="/home/taoc/nginx/sbin/nginx"
CONF_DIR="/home/taoc/uft30help/workspace"
HTML_DIR="/home/taoc/uft30help/html/uft3changecode"
CONF_FILE="$CONF_DIR/nginx.conf"
echo "=== Starting Help Documentation Server (Port 6045) ==="
echo ""
echo "1. Checking directories..."
if [ ! -d "$CONF_DIR" ]; then
mkdir -p "$CONF_DIR"
echo " Created config dir: $CONF_DIR"
else
echo " Config dir exists: $CONF_DIR"
fi
if [ ! -d "$HTML_DIR" ]; then
mkdir -p "$HTML_DIR"
echo " Created HTML dir: $HTML_DIR"
else
echo " HTML dir exists: $HTML_DIR"
fi
echo ""
echo "2. Killing all nginx processes..."
pkill -f nginx 2>/dev/null || true
sleep 2
pkill -9 nginx 2>/dev/null || true
sleep 1
echo " Done"
echo ""
echo "3. Starting nginx..."
"$NGINX_BIN" -c "$CONF_FILE"
sleep 2
echo ""
echo "4. Testing..."
echo ""
echo "=== Server Status ==="
if pgrep nginx > /dev/null; then
SERVER_IP=$(ip addr show | grep inet | grep -v '127.0.0.1' | grep -v '::1' | head -1 | awk '{print $2}' | cut -d'/' -f1)
echo "✅ Server running!"
echo ""
echo "=== Access URLs ==="
echo " Local: http://localhost:6045/uft3changecode/"
if [ -n "$SERVER_IP" ]; then
echo " Remote: http://$SERVER_IP:6045/uft3changecode/"
fi
else
echo "❌ Server not running"
echo "Error log:"
tail -20 /home/taoc/uft30help/workspace/logs/help_error.log
fi