Fix nginx config validation method
All checks were successful
Deploy Nginx Config to Ubuntu Server / deploy (push) Successful in 1s
All checks were successful
Deploy Nginx Config to Ubuntu Server / deploy (push) Successful in 1s
- Use proper nginx -t instead of -c option - Test by temporarily applying config, then restore - Validates against full nginx context 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3c0c3f46b4
commit
6a0393c11a
@ -45,12 +45,17 @@ jobs:
|
||||
- name: Validate new nginx configuration
|
||||
run: |
|
||||
echo "🔍 Validating new nginx configuration syntax..."
|
||||
# Create temporary copy to validate
|
||||
sudo cp server-nginx-default /tmp/nginx-test-config
|
||||
sudo nginx -t -c /tmp/nginx-test-config || {
|
||||
# Backup current config and test with new one
|
||||
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.temp.backup
|
||||
sudo cp server-nginx-default /etc/nginx/sites-available/default
|
||||
sudo nginx -t || {
|
||||
echo "❌ New nginx configuration has syntax errors!"
|
||||
# Restore backup
|
||||
sudo cp /etc/nginx/sites-available/default.temp.backup /etc/nginx/sites-available/default
|
||||
exit 1
|
||||
}
|
||||
# Restore backup for now (will apply later)
|
||||
sudo cp /etc/nginx/sites-available/default.temp.backup /etc/nginx/sites-available/default
|
||||
echo "✅ New configuration syntax is valid"
|
||||
|
||||
- name: Apply new nginx configuration
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user