Fix duplicate gzip directive in WordPress installation script#166
Merged
andchir merged 3 commits intoandchir:mainfrom Dec 31, 2025
Merged
Fix duplicate gzip directive in WordPress installation script#166andchir merged 3 commits intoandchir:mainfrom
andchir merged 3 commits intoandchir:mainfrom
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: andchir#165
This commit fixes issue andchir#165 where the WordPress installation script was failing with a duplicate gzip directive error during Nginx configuration. Problem: - The script was creating /etc/nginx/conf.d/gzip.conf with "gzip on;" - However, /etc/nginx/nginx.conf already has "gzip on;" by default - This caused nginx -t to fail with: "gzip" directive is duplicate Solution: - Removed the duplicate "gzip on;" directive from gzip.conf - Added explanatory comment noting that gzip is already enabled - Kept all other gzip configuration settings (compression level, types, etc.) The fix ensures that: 1. Nginx configuration test passes successfully 2. Gzip compression remains properly configured 3. No duplicate directives exist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This reverts commit 9c3e1f7.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
This was referenced Dec 31, 2025
konard
added a commit
to konard/andchir-install_scripts
that referenced
this pull request
Dec 31, 2025
## Problem When users ran the WordPress installation script multiple times: 1. First run with old script (before PR andchir#166) created gzip.conf with 'gzip on;' directive 2. PR andchir#166 was merged to fix the script, but doesn't recreate existing gzip.conf files 3. Second run with new script still fails because old gzip.conf has duplicate directive Error on re-run: ``` [X] Nginx configuration test failed 2025/12/31 13:25:29 [emerg] 38935#38935: "gzip" directive is duplicate in /etc/nginx/conf.d/gzip.conf:5 ``` ## Root Cause The script checks if gzip.conf exists and skips creation if it does (line 746). This means old buggy gzip.conf files from before PR andchir#166 are never updated. ## Solution Added detection and removal of outdated gzip.conf files: - Before creating gzip.conf, check if existing file contains 'gzip on;' directive - If found, remove the old file and recreate with correct configuration - This ensures both new installations and updates get the correct config ## Changes - Modified scripts/wordpress.sh:742-756 in configure_gzip_compression() function - Added detection for outdated gzip.conf containing 'gzip on;' directive - Added automatic removal and recreation of outdated config - Created experiments/test_gzip_fix.sh to verify the fix works correctly ## Testing Test script verifies: ✅ Old gzip.conf with 'gzip on;' is detected and removed ✅ New gzip.conf without 'gzip on;' is preserved ✅ All expected gzip directives are present 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #165 - Resolves duplicate gzip directive error in WordPress installation script
Problem
The WordPress installation script was failing during Nginx configuration with the following error:
Root cause: The script was creating
/etc/nginx/conf.d/gzip.confwith agzip on;directive, but the default/etc/nginx/nginx.confalready containsgzip on;(line 46), causing a duplicate directive error.Solution
Removed the duplicate
gzip on;directive from the generated/etc/nginx/conf.d/gzip.conffile:gzip on;which conflicted with the default nginx.confChanges
scripts/wordpress.sh:747-804-configure_gzip_compression()functiongzip on;directive from the generated gzip.conf fileTesting
Created and ran test script (
experiments/test_gzip_config.sh) to verify:gzip on;directive exists (no duplicates)Impact
This fix ensures that:
🤖 Generated with Claude Code