There are several reasons why Nginx may serve PHP files as downloads instead of executing them.
There are several reasons why a PHP header location redirect may not work: