我有这样一个问题,无法以某种方式进行nginx配置,即vts模块https://github.com/vozlt/nginx-module-vts将在每个特定位置生成指标。但是以我当前的配置,它根本无法工作。所有位置都被重定向到/app.php,Symfony接管了该位置,并且仅在此位置指标中正确生成了。在其他所有位置,nginx均不生成任何指标。有什么想法吗?
server {
listen 80 default_server;
root /var/app/web;
server_name _;
location = /health {
vhost_traffic_status_filter_by_set_key $host domain-health;
try_files $uri /app.php$is_args$args;
}
location = /metrics {
vhost_traffic_status_display;
vhost_traffic_status_display_format prometheus;
allow 10.42.0.0/16;
allow 172.16.0.0/12;
deny all;
}
location ^~ /test/api/ppeh/ {
vhost_traffic_status_filter_by_set_key $host domain-api-ppeh;
try_files $uri /app.php$is_args$args;
}
location ^~ /test/api/public/ {
vhost_traffic_status_filter_by_set_key $host domain-api-public;
try_files $uri /app.php$is_args$args;
}
location ^~ /test/api/_ {
vhost_traffic_status_filter_by_set_key $host domain-api-internal;
try_files $uri /app.php$is_args$args;
}
location ^~ /test/api/ {
vhost_traffic_status_filter_by_set_key $host domain-api;
try_files $uri /app.php$is_args$args;
}
location /test2/api/ {
vhost_traffic_status_filter_by_set_key $host domain-personalization-api;
try_files $uri /app.php$is_args$args;
}
location /test2/ {
vhost_traffic_status_filter_by_set_key $host domain-personalization-static;
try_files $uri /app.php$is_args$args;
}
location /test/ {
vhost_traffic_status_filter_by_set_key $host domain-static;
try_files $uri /app.php$is_args$args;
}
location = /test/version {
try_files $uri /version.txt;
}
location ~ ^/app\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param HTTPS $is_secure;
internal;
}
location ~ \.php$ {
return 404;
}
error_log /dev/stdout;
access_log /dev/stdout extended if=$loggable;
}