nginx grpc_pass exists now, and mostly you do not need it

nginx has proxied gRPC since 1.13.10, and the interesting question in a PHP shop is whether gRPC is the right thing to be proxying at all.

server {
    listen 443 ssl http2;

    location / {
        grpc_pass grpc://backend:50051;
        grpc_read_timeout 300s;
    }
}

# note: HTTP/2 is required end to end. an HTTP/1.1 hop breaks it.

The HTTP/2 requirement is the practical constraint and it rules out several load balancers that terminate at 1.1. For internal service-to-service calls where both ends are yours, gRPC’s schema and code generation are a genuine improvement over JSON over HTTP; for anything a browser or a third party touches, it is not, and a REST endpoint remains the right answer in 2019. Adding it because it is faster is usually optimising a hop that was not the bottleneck.