AdminsForum
Guide Test Nginx Performance and Gzip Compression in aaPanel - Printable Version

+- AdminsForum (https://adminsforum.com)
+-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels)
+--- Forum: aaPanel (https://adminsforum.com/Forum-aapanel)
+---- Forum: aaPanel Guides & Tutorials (https://adminsforum.com/Forum-aapanel-guides-tutorials)
+----- Forum: aaPanel Websites & Web Servers Guides (https://adminsforum.com/Forum-aapanel-websites-web-servers-guides)
+----- Thread: Guide Test Nginx Performance and Gzip Compression in aaPanel (/Thread-guide-test-nginx-performance-and-gzip-compression-in-aapanel)



Test Nginx Performance and Gzip Compression in aaPanel - DEV - 10-14-2026

Nginx tuning should start with measurements, not a list of larger limits. This guide checks worker settings and gzip behavior, demonstrates a real compression tradeoff, and explains when to restore a change.

Tested: aaPanel Free 8.0.7, Nginx 1.30.5 and Ubuntu 22.04.5 on the shared two-CPU lab VPS. No production configuration was changed.

1. Inspect the active configuration
Open App Store → Installed → Nginx → Setting and inspect its configuration. Paths and interface labels can differ by release. Our global file was /www/server/nginx/conf/nginx.conf; website configurations were included separately.
A configuration dump can help identify includes:
Code:
/www/server/nginx/sbin/nginx -T
Keep the output private because it can reveal hostnames, paths and configuration details. Identify which file owns the directive before editing it.

2. Review workers and connection limits
Our server already used worker_processes auto and worker_connections 51200. We did not increase either. More permitted connections do not mean more requests per second: upstream connections, open-file limits, PHP workers, database work and CPU also constrain throughput.
Inspect actual worker count, active connections, system file limits and errors during representative traffic. Raise a limit only if it is the observed bottleneck and the server has resources to support it. Avoid treating a high worker_connections value as a visitor-capacity guarantee.
Keepalive settings also need workload evidence. Shorter idle time can reduce held connections but increase connection setup; longer idle time can retain resources. We left the existing 60-second setting unchanged.

3. Back up before a compression experiment
Make a private copy of the active file. Our baseline already had gzip enabled, a 1KiB minimum length, compression level 5 and gzip_vary on. Its gzip_types included text, JavaScript, CSS, JSON and several image types.
Inspect response headers and actual transfer sizes before changing MIME types. Many image formats contain compressed data, but the effect of an additional gzip layer depends on the particular file.

4. Test text and image responses
We created an original 24,500-byte text fixture in the lab website and used an existing 3,113-byte WordPress PNG. We requested gzip explicitly over loopback HTTPS with normal certificate validation.
A basic header check is:
Code:
curl -sS -D - -o /dev/null \   -H 'Accept-Encoding: gzip' https://example.com/test.txt
Use your own hostname and a safe test file. Inspect Content-Encoding, Vary and HTTP status. To compare raw encoded bytes, save the response body without automatic decompression. curl --compressed instead requests supported compression and decompresses the body, so do not confuse decoded size with wire size.
Our test compared the baseline against removing JPEG/GIF/PNG from gzip_types. It did not change the compression level or worker limits.

   
AdminsForum formatted transcript of the experiment, not a screenshot.

5. Interpret the evidence
  • Text: gzip was used in both phases; the body transferred was 156 bytes and decoded to 24,500 bytes.
  • PNG before: gzip body 2,487 bytes, decoded to 3,113 bytes.
  • PNG after: no gzip; body transferred 3,113 bytes.
  • All responses returned HTTP 200, and decoded content hashes matched.
Removing image compression increased transfer size for this particular small PNG. We did not measure CPU savings, so we did not claim the change improved performance. These body sizes exclude headers and transport overhead; one file does not represent an entire image library.

6. Validate, reload and restore when appropriate
Code:
/www/server/nginx/sbin/nginx -t /www/server/nginx/sbin/nginx -s reload
Validation passed for the experiment. Because we had no demonstrated overall benefit, we restored the original configuration, validated it again and reloaded Nginx. A successful reload is not an application test: check important pages, TLS, redirects, upstream errors and logs afterwards.
Do not keep an optimization solely because it looks conventional. Record the tradeoff and test enough representative content to support a decision.

7. Apply this method to a real high-traffic site
Collect response latency, transfer sizes, CPU, connection counts and upstream timing over comparable windows. Separate cached and uncached requests. Change one variable at a time and repeat the same workload. Keep a rollback copy and stop if errors or resource pressure increase.
A compression change cannot repair slow SQL or exhausted PHP workers. Use the database and PHP-FPM guides alongside this test, then investigate the bottleneck actually observed.

Reference: Official Nginx gzip module documentation.