Answer the question
In order to leave comments, you need to log in
How to disable nginx log for one route in Laravel/Lumen application?
nginx, php-fpm, Lumen
nginx config:
upstream php {
server php-fpm:9000;
}
server {
# ...
root /var/www/lumen/public;
try_files $uri $uri/ /index.php$is_args$args;
# ...
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass php;
}
}
location /api/servertime {
access_log off;
}
location ~ \.php$ {
location ~ ^/api/servertime$ { access_log off; }
Answer the question
In order to leave comments, you need to log in
location = /api/servertime {
access_log off;
rewrite ^ /index.php break;
include fastcgi.conf;
fastcgi_pass php;
}
location ~ \.php$
location ~ \.php$ {
if ($request_uri ~ "^/api/servertime") {
access_log off;
}
include fastcgi.conf;
fastcgi_pass php;
}
access_log путь [формат [if=условие]];
map $request_uri $loggable {
default 1;
~^/api/servertime 0;
}
server {
# ...
root /var/www/lumen/public;
try_files $uri $uri/ /index.php$is_args$args;
# ...
location ~ \.php$ {
access_log /var/log/nginx/access.log combined if=$loggable;
include fastcgi.conf;
fastcgi_pass php;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question