-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add web server configuration guide for feature branch deployment #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
69c8a08
style: apply yoda conditions and fn spacing in requirements functions
konradmichalik 4452987
docs: add web server configuration guide for feature branch deployment
konradmichalik 425af2c
docs: remove redundant deny directive and add socket path hint
konradmichalik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # Web server | ||
|
|
||
| The feature branch deployment supports both **Apache** and **nginx** as web server. The deployment tooling itself is web server agnostic — it uses filesystem symlinks for URL shortening and does not generate or depend on any web server configuration files. | ||
|
|
||
| ## Apache | ||
|
|
||
| Apache works with minimal effort because TYPO3 and Symfony ship with `.htaccess` files that handle URL rewriting per directory. When a new feature branch is deployed, the application's `.htaccess` is available immediately without any web server restart or configuration change. | ||
|
|
||
| The only requirement is that `AllowOverride All` is set for the document root in the vhost configuration. | ||
|
|
||
| ## nginx | ||
|
|
||
| Since nginx does not support per-directory configuration files like `.htaccess`, the URL rewriting and PHP routing must be defined in the server block configuration. This requires a one-time setup that covers all current and future feature branch instances. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. **Symlinks** must be followed (this is the nginx default). Ensure `disable_symlinks` is **not** set to `on`. | ||
|
|
||
| 2. **PHP-FPM** must be configured to process `.php` files in subdirectories, not just the document root. | ||
|
|
||
| 3. **URL rewriting** for the application (TYPO3 or Symfony) must be handled in the server block, since there is no `.htaccess` to fall back on. | ||
|
|
||
| ### Example for TYPO3 | ||
|
|
||
| ```nginx | ||
| server { | ||
| listen 443 ssl; | ||
| server_name demo.local; | ||
| root /var/www/html; | ||
| index index.php index.html; | ||
|
|
||
| # Feature branch instances and main application | ||
| location / { | ||
| try_files $uri $uri/ @rewrite; | ||
| } | ||
|
|
||
| # Rewrite all non-file requests to the nearest index.php. | ||
| # Supports both root-level and feature branch subdirectory requests. | ||
| location @rewrite { | ||
| rewrite ^/([^/]+)/(.*)$ /$1/index.php last; | ||
| rewrite ^(.*)$ /index.php last; | ||
| } | ||
|
|
||
| # Deny access to protected directories across all instances | ||
| location ~ /(typo3conf|var|config)/ { | ||
| return 403; | ||
| } | ||
|
|
||
| # PHP-FPM for all .php files including subdirectories | ||
| location ~ \.php$ { | ||
| include fastcgi_params; | ||
| fastcgi_pass unix:/run/php/php-fpm.sock; # adjust to match your PHP-FPM pool socket | ||
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
| try_files $uri =404; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| See also the official [TYPO3 nginx configuration guide](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Configuration/WebServer/Nginx.html) for application-specific details. | ||
|
|
||
| ### Example for Symfony | ||
|
|
||
| ```nginx | ||
| server { | ||
| listen 443 ssl; | ||
| server_name demo.local; | ||
| root /var/www/html; | ||
| index index.php index.html; | ||
|
|
||
| location / { | ||
| try_files $uri $uri/ @rewrite; | ||
| } | ||
|
|
||
| location @rewrite { | ||
| rewrite ^/([^/]+)/(.*)$ /$1/index.php last; | ||
| rewrite ^(.*)$ /index.php last; | ||
| } | ||
|
|
||
| location ~ \.php$ { | ||
| include fastcgi_params; | ||
| fastcgi_pass unix:/run/php/php-fpm.sock; # adjust to match your PHP-FPM pool socket | ||
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
| try_files $uri =404; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## User group | ||
|
|
||
| The web server user group might differ between Apache (`www-data`) and nginx (`nginx` or `www-data` depending on distribution). Adjust the deployer configuration accordingly: | ||
|
|
||
| ```php | ||
| set('requirements_user_group', 'nginx'); | ||
| ``` | ||
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.
Uh oh!
There was an error while loading. Please reload this page.