[Feat] [4.x] Apache Support (Beta)#1122
Draft
RichardAnderson wants to merge 8 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Apache (beta) as a supported webserver alongside Nginx and Caddy, and refactors vhost/config generation to be webserver-driven via a configGenerator() abstraction. It also updates site settings behavior and SSH templates/tests to cover Apache-specific operations (install, splash, vhost generation, verification handling, logs, and basic auth).
Changes:
- Introduces
App\Services\Webserver\Apacheplus Apache SSH templates (install/uninstall, vhost CRUD, SSL creation, splash). - Refactors webserver config generation via
Webserver::configGenerator()and makes htpasswd path webserver-dependent (basicAuthDir()). - Adds/updates PHPUnit coverage for Apache install, config generation, verification blocks, basic auth behavior, service logs, and vhost template defaults.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/SSH/Services/Webserver/DeploySplashTest.php | Adds Apache splash deployment SSH assertions. |
| tests/Unit/Actions/Webserver/GenerateApacheConfigTest.php | New unit tests for Apache vhost generation edge-cases (FPM, auth, ACME, redirects, verification, force-SSL). |
| tests/Unit/Actions/Service/InstallTest.php | Adds Apache install test expectations (systemd override). |
| tests/Feature/Webserver/VerificationBlockTest.php | Adds Apache verification block coverage. |
| tests/Feature/SiteSettings/VhostTemplateTest.php | Ensures default vhost template matches active webserver (nginx/apache/caddy). |
| tests/Feature/SiteSettings/BasicAuthTest.php | Verifies Apache writes htpasswd file on basic auth update. |
| tests/Feature/ServiceLogsTest.php | Adds expectations for Apache log catalogue entries. |
| resources/views/ssh/services/webserver/shared/write-basic-auth-file.blade.php | Generalizes htpasswd file ownership to a webserverUser. |
| resources/views/ssh/services/webserver/shared/remove-basic-auth-file.blade.php | New shared script to remove htpasswd file idempotently. |
| resources/views/ssh/services/webserver/apache/vhost.mustache | New Apache Mustache vhost template. |
| resources/views/ssh/services/webserver/apache/uninstall-apache.blade.php | New Apache uninstall script. |
| resources/views/ssh/services/webserver/apache/install-apache.blade.php | New Apache install script (modules, envvars, systemd override). |
| resources/views/ssh/services/webserver/apache/get-vhost.blade.php | New script to read an Apache vhost file. |
| resources/views/ssh/services/webserver/apache/delete-site.blade.php | New script to disable/remove Apache site and delete path. |
| resources/views/ssh/services/webserver/apache/default-vhost.blade.php | New default “splash” vhost for Apache. |
| resources/views/ssh/services/webserver/apache/create-vhost.blade.php | New script to enable site, configtest, and reload Apache. |
| resources/views/ssh/services/webserver/apache/create-path.blade.php | New script to create site path and set perms. |
| resources/views/ssh/services/webserver/apache/create-letsencrypt-ssl.blade.php | New certbot webroot SSL creation script for Apache. |
| resources/views/ssh/services/webserver/apache/create-custom-ssl.blade.php | New script to write custom cert/key for Apache. |
| resources/js/pages/site-settings/index.tsx | Enables Basic Auth UI section for Apache sites. |
| app/Services/Webserver/Webserver.php | Extends interface with configGenerator() + basicAuthDir(). |
| app/Services/Webserver/Nginx.php | Implements generator + basicAuthDir; switches to shared htpasswd removal. |
| app/Services/Webserver/Caddy.php | Implements generator + basicAuthDir (null). |
| app/Services/Webserver/Apache.php | New Apache webserver implementation (install/uninstall/vhost/ssl/logs/splash). |
| app/Services/Webserver/AbstractWebserver.php | Centralizes static type(): 'webserver' for webservers. |
| app/Providers/ServiceTypeServiceProvider.php | Registers Apache service type metadata and config path. |
| app/Models/Site.php | Makes htpasswdPath() webserver-aware and nullable. |
| app/Http/Controllers/SiteSettingController.php | Uses site->webserver()->configGenerator() for default vhost template. |
| app/Actions/Webserver/GenerateApacheConfig.php | New Apache config generator implementation. |
| app/Actions/Webserver/AbstractGenerateConfig.php | Adds overridable formatConfig() and handles nullable htpasswd path. |
| app/Actions/Site/UpdateVhostTemplate.php | Uses webserver’s configGenerator() to compare against defaults. |
| app/Actions/Site/UpdateBasicAuth.php | Writes htpasswd for any webserver that exposes a basic auth dir; uses shared scripts. |
Member
Author
|
Once site-stats is merged, just need to make the branch for access log locations generic in this PR |
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.
This pull request introduces support for Apache as a webserver alongside Nginx and Caddy, refactors the webserver configuration generation system for extensibility, and updates related logic throughout the codebase.
NOTE: Many updates in the PR improve support for additional web servers, and remove hard-coded elements and IDs.