My nginx rewrite is downloading the php file

Solution 1:

Change break to last.

Because the new URL will need to be processed by a different location, you need to have nginx restart processing for the new rewritten URL, which is only done when you use last in the rewrite rule.

See the docs for a fuller explanation.