Skip to content

Commit 4452987

Browse files
docs: add web server configuration guide for feature branch deployment
1 parent 69c8a08 commit 4452987

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

docs/FEATURE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ The following steps are necessary to successfully setup the deployment workflow:
3030

3131
Choose an according [database management](DATABASE.md) type for your application.
3232

33+
Configure your [web server](WEBSERVER.md) (Apache or nginx) to serve feature branch instances.
34+
3335
Add the following line to your deployer host entry, to enable the feature branch deployment for this stage:
3436

3537
```yaml

docs/WEBSERVER.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Web server
2+
3+
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.
4+
5+
## Apache
6+
7+
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.
8+
9+
The only requirement is that `AllowOverride All` is set for the document root in the vhost configuration.
10+
11+
## nginx
12+
13+
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.
14+
15+
### Prerequisites
16+
17+
1. **Symlinks** must be followed (this is the nginx default). Ensure `disable_symlinks` is **not** set to `on`.
18+
19+
2. **PHP-FPM** must be configured to process `.php` files in subdirectories, not just the document root.
20+
21+
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.
22+
23+
### Example for TYPO3
24+
25+
```nginx
26+
server {
27+
listen 443 ssl;
28+
server_name demo.local;
29+
root /var/www/html;
30+
index index.php index.html;
31+
32+
# Feature branch instances and main application
33+
location / {
34+
try_files $uri $uri/ @rewrite;
35+
}
36+
37+
# Rewrite all non-file requests to the nearest index.php.
38+
# Supports both root-level and feature branch subdirectory requests.
39+
location @rewrite {
40+
rewrite ^/([^/]+)/(.*)$ /$1/index.php last;
41+
rewrite ^(.*)$ /index.php last;
42+
}
43+
44+
# Deny access to protected directories across all instances
45+
location ~ /(typo3conf|var|config)/ {
46+
deny all;
47+
return 403;
48+
}
49+
50+
# PHP-FPM for all .php files including subdirectories
51+
location ~ \.php$ {
52+
include fastcgi_params;
53+
fastcgi_pass unix:/run/php/php-fpm.sock;
54+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
55+
try_files $uri =404;
56+
}
57+
}
58+
```
59+
60+
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.
61+
62+
### Example for Symfony
63+
64+
```nginx
65+
server {
66+
listen 443 ssl;
67+
server_name demo.local;
68+
root /var/www/html;
69+
index index.php index.html;
70+
71+
location / {
72+
try_files $uri $uri/ @rewrite;
73+
}
74+
75+
location @rewrite {
76+
rewrite ^/([^/]+)/(.*)$ /$1/index.php last;
77+
rewrite ^(.*)$ /index.php last;
78+
}
79+
80+
location ~ \.php$ {
81+
include fastcgi_params;
82+
fastcgi_pass unix:/run/php/php-fpm.sock;
83+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
84+
try_files $uri =404;
85+
}
86+
}
87+
```
88+
89+
## User group
90+
91+
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:
92+
93+
```php
94+
set('requirements_user_group', 'nginx');
95+
```

0 commit comments

Comments
 (0)