Scaffold Symfony 8 app with Bootstrap/DataTables and Docker stack
- Symfony 8.1 webapp skeleton on PHP 8.5 (AssetMapper/importmap, no Node)
- Form-login gate: User entity, security.yaml, SecurityController,
app:user:create command, initial migration (user + messenger_messages)
- Bootstrap 5 + DataTables layout (base/login/home templates); any
table.datatable is auto-initialised
- trusted_proxies/headers wired for the shared Nginx Proxy Manager
- Docker (servers only): docker-compose.yml (php:8.5-fpm-alpine,
nginx:1.30-alpine, mariadb:12.3; host ports 8085/3310; external
docker_default network) + docker/{Dockerfile,php.ini,nginx,setup.sh,restart.sh}
- .env with CHANGEME placeholders (no secrets), .gitattributes enforces
LF so the deploy scripts stay runnable on Linux
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
server {
|
||||
listen 80;
|
||||
# Only ever reached via the server's shared Nginx Proxy Manager, which
|
||||
# terminates TLS and forwards traffic for this domain here - this container
|
||||
# itself doesn't need to know about HTTPS or other domains.
|
||||
server_name dmtools.fvandenberg.nl;
|
||||
root /var/www/html/public;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
# A plain "fastcgi_pass php:9000" resolves once at worker start and
|
||||
# caches that IP forever - if the php container is recreated without
|
||||
# also restarting nginx, every request 502s. Routing through a variable
|
||||
# forces re-resolution per the resolver TTL. 127.0.0.11 is Compose's
|
||||
# embedded DNS. Use the globally-unique container name, not the bare
|
||||
# "php" alias: this nginx is also on the shared proxy network where
|
||||
# another project may also have a service called "php".
|
||||
resolver 127.0.0.11 valid=10s;
|
||||
set $php_upstream dmtools-php:9000;
|
||||
fastcgi_pass $php_upstream;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
|
||||
# fastcgi_params never forwards Host - forward the real one explicitly.
|
||||
fastcgi_param HTTP_HOST $http_host;
|
||||
|
||||
# fastcgi_pass does NOT auto-forward incoming headers. Without these,
|
||||
# Symfony can't tell the original request was HTTPS and redirects to
|
||||
# itself forever. if_not_empty: NPM omits some of these entirely, and an
|
||||
# empty-but-present header can behave differently from an absent one.
|
||||
fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto if_not_empty;
|
||||
fastcgi_param HTTP_X_FORWARDED_FOR $http_x_forwarded_for if_not_empty;
|
||||
fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host if_not_empty;
|
||||
fastcgi_param HTTP_X_FORWARDED_PORT $http_x_forwarded_port if_not_empty;
|
||||
|
||||
fastcgi_read_timeout 120;
|
||||
internal;
|
||||
}
|
||||
|
||||
# Everything else under public/ (compiled assets, favicon, robots) is served
|
||||
# straight off disk; only index.php is ever executed.
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
|
||||
error_log /var/log/nginx/dmtools_error.log;
|
||||
access_log /var/log/nginx/dmtools_access.log;
|
||||
|
||||
client_max_body_size 20M;
|
||||
}
|
||||
Reference in New Issue
Block a user