- Added Express server with Git info API endpoint - Created automated deployment scripts (systemd-based, not PM2) - Implemented 5-minute auto-sync with GitHub - Enhanced .gitignore with 200+ credential protection patterns - Added Git version badge to UI footer - Created comprehensive deployment documentation - Added TurnKey Nginx fix for default control panel issue - Included security verification tools All credentials protected and verified safe for deployment.
5.5 KiB
🔧 IMPORTANT: TurnKey Control Panel Fix
❗ Problem: Seeing TurnKey Control Panel Instead of Your App
If you see this page when accessing your server:
This means Nginx is still serving the TurnKey default page instead of your application.
✅ SOLUTION
Option 1: Run the Quick Fix Script (Recommended)
SSH into your server and run:
cd /var/www/web-page-performance-test
chmod +x fix-nginx.sh
./fix-nginx.sh
This script will:
- ✅ Remove ALL TurnKey default Nginx sites
- ✅ Enable your application's Nginx configuration
- ✅ Reload Nginx
- ✅ Show you verification steps
Option 2: Manual Fix
If the script doesn't exist yet, manually fix Nginx:
# SSH into your server
ssh root@YOUR_SERVER_IP
# Remove TurnKey default sites
rm -f /etc/nginx/sites-enabled/default
rm -f /etc/nginx/sites-enabled/nodejs
rm -f /etc/nginx/sites-enabled/node*
rm -f /etc/nginx/sites-enabled/tkl-webcp
# Create the proper Nginx configuration for your app
cat > /etc/nginx/sites-available/web-page-performance-test << 'EOF'
server {
listen 80 default_server;
server_name _;
# Serve static files directly from application directory
root /var/www/web-page-performance-test;
index index.html;
# Serve static files directly
location / {
try_files $uri $uri/ /index.html;
}
# Proxy API requests to Node.js
location /api {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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;
proxy_cache_bypass $http_upgrade;
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
EOF
# Enable your site
ln -sf /etc/nginx/sites-available/web-page-performance-test /etc/nginx/sites-enabled/
# Test and reload Nginx
nginx -t && systemctl reload nginx
🔍 Verify the Fix
After running either fix option:
-
Refresh your browser (hard refresh: Ctrl+F5 or Cmd+Shift+R)
-
You should now see YOUR application instead of the TurnKey page
-
Check that your static files are being served:
ls -la /var/www/web-page-performance-testYou should see:
index.html,styles.css,Logo.png, etc. -
Check Git version badge in the footer - it should show commit info
🎯 Why This Happens
TurnKey Linux templates come with pre-configured Nginx sites that display their control panel (Webmin). When you deploy your application, the deployment script should:
- Remove these TurnKey default sites
- Create YOUR application's Nginx configuration
- Enable only YOUR site
- Reload Nginx
If you accessed the server before running the full deployment, or if the deployment had issues, the TurnKey defaults remain active.
📋 Prevention: Proper Deployment Order
To avoid this issue, always:
- Create
deploy-config.jsonwith your credentials - Run
.\deploy-local.ps1from your local Windows machine - Wait for "Deployment Complete!" message
- Then access
http://YOUR_SERVER_IPin browser
The deployment script (deploy-local.ps1 → deploy-server.sh) automatically handles the Nginx configuration.
🚀 Updated Deployment Scripts
I've updated the deployment scripts to:
- ✅ More aggressively remove TurnKey default sites
- ✅ Set your app as
default_serverin Nginx - ✅ Include
fix-nginx.shfor quick repairs - ✅ Serve static files directly (faster!)
- ✅ Only proxy
/apirequests to Node.js
📊 How It Should Look
❌ WRONG (TurnKey Page)
- Title: "TurnKey Node.js"
- Shows "Webmin" link
- Shows "Resources" section
- Shows TurnKey logo
✅ CORRECT (Your App)
- Your custom page title
- Beyond Cloud Technology branding
- Your project content
- Git version badge in footer
- Modern dark theme design
🆘 Still Having Issues?
If after the fix you still see the TurnKey page:
-
Check if files exist:
ls -la /var/www/web-page-performance-testIf empty, the repository wasn't cloned. Run full deployment.
-
Check which Nginx sites are enabled:
ls -la /etc/nginx/sites-enabled/Should ONLY show:
web-page-performance-test -
Check Nginx configuration:
nginx -t cat /etc/nginx/sites-enabled/web-page-performance-test -
Check Nginx error logs:
tail -50 /var/log/nginx/error.log -
Check if Node.js is running:
systemctl status web-page-performance-test -
Full redeploy: If all else fails, run the deployment script again:
.\deploy-local.ps1
✅ Quick Checklist
- SSH into server:
ssh root@YOUR_SERVER_IP - Run fix script:
cd /var/www/web-page-performance-test && ./fix-nginx.sh - Wait for "✅ Nginx Fixed!" message
- Refresh browser (hard refresh)
- See YOUR application!
The fix is simple - just remove the TurnKey defaults and enable your app! 🚀
