HTTP health check failed on port 8000

I’ve configured application to be exposed to 8000 in Dockerfile, I have nginx.conf listening on port 8000 and even have this health check thing

server {
listen 8000;
index index.php index.html;
server_name localhost;
root /var/www/laravel/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /healthz {
return 200 ‘OK’;
add_header Content-Type text/plain;
}
location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

I’ve even set both nginx ports to 8000

nginx:
image: “nginx:stable-alpine”
ports:
- “8000:8000”
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- .:/var/www/laravel

but it keeps giving me HTTP health check failed on port 8000.