Commit Graph

17 Commits

Author SHA1 Message Date
1490bde56e Switch shared vhost from SetHandler to ProxyPassMatch for PHP-FPM
Some checks failed
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m7s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 1m59s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 2m3s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 2m26s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 2m21s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 1m51s
Cloud Apache Container / Build-FPM-Images (74) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (80) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (81) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (82) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (83) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (84) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (85) (push) Has been cancelled
Cloud Apache Container / Build-Shared-httpd (push) Has been cancelled
Cloud Apache Container / Build-and-Push (85) (push) Has been cancelled
SetHandler + ProxyFCGISetEnvIf doesn't work for path remapping because
reqenv('SCRIPT_FILENAME') is empty when the directive evaluates with
the SetHandler approach.

ProxyPassMatch directly maps .php URLs to the FPM container's filesystem
path, bypassing the SCRIPT_FILENAME rewrite issue entirely:
  ^/(.*\.php(/.*)?)$ -> fcgi://fpm:9000/home/{user}/public_html/$1

Static assets (CSS, JS, images) bypass the proxy since they don't match
\.php and are served directly by Apache from the read-only mount.

Tested and confirmed working on live site with WordPress (including
pretty URLs via .htaccess mod_rewrite).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:50:54 -07:00
e5e055d198 Fix ProxyFCGISetEnvIf syntax for SCRIPT_FILENAME rewrite
Some checks failed
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m1s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 2m25s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 2m15s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 1m18s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 2m17s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 2m46s
Cloud Apache Container / Build-and-Push (85) (push) Successful in 1m18s
Cloud Apache Container / Build-FPM-Images (74) (push) Successful in 1m18s
Cloud Apache Container / Build-FPM-Images (81) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (82) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (83) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (84) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (85) (push) Has been cancelled
Cloud Apache Container / Build-Shared-httpd (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (80) (push) Has been cancelled
The previous expr= with s|...|...| substitution syntax doesn't exist
in Apache expressions — it silently failed, leaving SCRIPT_FILENAME
pointing to /mnt/users/ which PHP-FPM can't find.

Fixed to use regex match in the conditional with backreferences:
  reqenv('SCRIPT_FILENAME') =~ m#^/mnt/users/([^/]+)/([^/]+)/public_html(.*)#
  -> /home/$1/public_html$3

This is also generic (captures user from the path) so the template
no longer needs per-user placeholder substitution for this directive.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:32:52 -07:00
c68b555a5f Fix PHP-FPM path mismatch in shared httpd vhost template
Some checks failed
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m9s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 2m12s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 1m57s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 1m25s
Cloud Apache Container / Build-and-Push (84) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (85) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (74) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (80) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (81) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (82) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (83) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (84) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (85) (push) Has been cancelled
Cloud Apache Container / Build-Shared-httpd (push) Has been cancelled
Cloud Apache Container / Build-and-Push (83) (push) Has been cancelled
The shared httpd serves files from /mnt/users/{user}/{domain}/public_html
but PHP-FPM containers have them at /home/{user}/public_html. When Apache
proxied PHP requests via fcgi, SCRIPT_FILENAME pointed to the Apache path
which doesn't exist inside the FPM container, causing "File not found".

Added ProxyFCGISetEnvIf to rewrite SCRIPT_FILENAME from the shared httpd
path to the FPM container path before proxying the request.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:22:53 -07:00
c78167871c Add shared httpd + PHP-FPM-only container architecture
Some checks failed
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m22s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 3m14s
Cloud Apache Container / Build-and-Push (82) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (83) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (84) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (85) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (74) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (80) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (81) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (82) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (83) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (84) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (85) (push) Has been cancelled
Cloud Apache Container / Build-Shared-httpd (push) Has been cancelled
Cloud Apache Container / Build-and-Push (81) (push) Has been cancelled
Separate Apache and PHP-FPM into distinct container roles to reduce
per-customer memory overhead on shared servers. Adds three new images:
- Dockerfile.fpm: PHP-FPM only (no Apache), listens on TCP port 9000
- Dockerfile.shared-httpd: Apache only (no PHP), with SSL and proxy_fcgi
- Existing Dockerfile unchanged for standalone mode

Key changes:
- detect-memory.sh: CONTAINER_ROLE env var (combined/fpm_only/httpd_only)
  controls the memory budget split
- create-php-config.sh: FPM_LISTEN env var for TCP port vs Unix socket,
  added /fpm-ping and /fpm-status health endpoints
- New entrypoints for each container role
- tune-mpm.sh for hot-adjusting Apache MPM settings
- shared-vhost-template.tpl with proxy_fcgi and SSL on port 443
- CI/CD builds all three image types in parallel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:08:00 -07:00
87c4f2befc Optimize Apache & PHP-FPM memory for lower idle usage
All checks were successful
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m31s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 1m54s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 1m51s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 1m52s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 2m39s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 1m58s
Cloud Apache Container / Build-and-Push (85) (push) Successful in 1m51s
Switch PHP-FPM from pm=dynamic to pm=ondemand (zero idle workers),
auto-detect container memory via cgroups to calculate appropriate
limits, and generate Apache MPM config at runtime. All tuning values
are now overridable via environment variables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:52:15 -08:00
154f42ae09 Optimize memory usage for Apache and PHP-FPM, remove ioncube-loader
All checks were successful
Cloud Apache Container / Build-and-Push (74) (push) Successful in 3m7s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 1m42s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 1m37s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 1m39s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 3m3s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 1m40s
- Apache mpm_event: Reduced StartServers from 10 to 2, adjusted spare threads
  and worker limits for container environments
- PHP-FPM: Switched from static to dynamic process management with lower
  process counts (5 max children instead of 10)
- Removed php-ioncube-loader from PHP 8.0 installation
- Expected memory reduction: 60-70% in idle state while maintaining responsiveness

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-20 16:52:04 -07:00
b5857d73c2 Fix issue where PHP Sessions were not working as expected
All checks were successful
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m37s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 44s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 1m41s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 1m39s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 1m37s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 1m35s
2025-07-20 12:06:15 -07:00
88f462eb04 Updated the README.md
All checks were successful
Cloud Apache Container / Build-and-Push (push) Successful in 1m1s
Added a healthcheck to the container
adjusted Apache limits for memory consumption
switch to microdnf for improved memory usage
2025-07-16 05:56:33 -07:00
e7b0bce666 Update MariaDB Version
All checks were successful
Cloud Apache Container / Build-and-Push (push) Successful in 41s
2025-06-14 16:02:00 -07:00
5a097034c4 Update MariaDB Version
All checks were successful
Cloud Apache Container / Build-and-Push (push) Successful in 44s
2025-03-16 11:12:46 -07:00
a41157fad0 fix url
All checks were successful
Cloud Apache Container / Build-and-Push (push) Successful in 39s
2025-03-16 10:58:25 -07:00
4fd7ee465a Adding support for PHP 8.4 and upgrading MariaDB to 11.4.5
All checks were successful
Cloud Apache Container / Build-and-Push (push) Successful in 47s
2025-03-16 10:43:16 -07:00
49c5438866 Added fix for issues found while setting up anhonesthost 2024-12-17 21:44:09 -08:00
527ba5cf58 Adding better backups and log rotation, and updating files around it 2024-10-14 19:30:51 -07:00
2545d91e04 Some tuning of PHP and apache 2023-04-11 13:23:14 -07:00
908f38eb26 Create a healthcheck lookup 2023-04-09 16:06:00 -07:00
95b9397067 Finished Cloud Apache Container 2023-04-05 07:53:20 -07:00