- Update Nginx logging with structured JSON and standard combined format for Elastic integration.

- Add new upstream PHP-FPM servers to Nginx configuration for enhanced load balancing.
- Introduce Elastic APM PHP agent in `php.ini` and update Dockerfile for better dependency management.
- Secure Kibana and Elasticsearch connections in Metricbeat/Filebeat configurations with credentials.
- Remove unused PHP dependencies from `composer.json` and `composer.lock`.
This commit is contained in:
Jeppe Bundgaard
2026-02-16 10:58:50 +01:00
parent 8d8137852f
commit 8c8de541be
9 changed files with 216 additions and 1566 deletions
+52
View File
@@ -34,6 +34,9 @@ http {
least_conn;
server php1:9000 max_fails=3 fail_timeout=10s;
server php2:9000 max_fails=3 fail_timeout=10s;
server php3:9000 max_fails=3 fail_timeout=10s;
server php4:9000 max_fails=3 fail_timeout=10s;
server php5:9000 max_fails=3 fail_timeout=10s;
keepalive 32;
}
@@ -46,6 +49,55 @@ http {
return 301 https://$host$request_uri;
}
# Localhost api server block (api.truckwash.dk)
server {
listen 80;
server_name localhost;
# Logging
add_header X-Request-Id $req_id always;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.ndjson json;
# Index file
index index.php index.html index.htm;
# Root directory (public- uses index.php)
root /var/www/html;
# Location block for PHP files
location ^~ / {
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With, X-Customer-Number";
add_header Access-Control-Allow-Credentials true;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With, X-Customer-Number";
return 204;
}
include fastcgi_params;
fastcgi_pass php_fpm;
fastcgi_index index.php;
fastcgi_read_timeout 60s;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param X_REQUEST_ID $req_id;
fastcgi_keep_conn on;
}
# Deny access to .htaccess files
location ~ /\.ht {
deny all;
}
# Deny access to hidden files
location ~ /\. {
deny all;
}
}
server {
listen 443 ssl;
server_name api.truckwash.dk;