How do I only reverse proxy php files with nginx?

Solution 1:

At first, not sure why you need apache behind nginx.

Now, if you don't do rewrites in Apache which hide the PHP extension, just modify your location block like this:

location ~ \.php$ {
    proxy_set_header       Host $host;
    proxy_set_header       X-Real-IP  $remote_addr;
    proxy_set_header       X-Forwarded-Proto $scheme;
    X-Forwarded-For        $proxy_add_x_forwarded_for;

    proxy_pass             https://localhost:8081;
    proxy_read_timeout     90;
    proxy_redirect         http://localhost:8080 https://envy.zone;
}

And you should be good to go.