PHP-FPM和Nginx重写导致下载

我有一个Nginx的HTTP服务器PHP-FPM设置,几乎一切正常。 我想能够去path/to/file ,它给我index.php?url=path/to/file ,它做的。 但是,它下载实际的PHP,它不会在浏览器中执行它。 我不确定是什么原因造成的。

Nginxconfiguration:

 server { listen 80; server_name sandbox.domain.tld; access_log /path/to/domain/log/sandbox.access.log; error_log /path/to/domain/log/sandbox.error.log; location / { root /path/to/sandbox; index index.php; if (!-e $request_filename) { rewrite ^/beta/(.+)$ /beta/index.php?url=$1 break; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /usr/local/nginx/conf/fastcgi_params; fastcgi_param SCRIPT_FILENAME /path/to/sandbox$fastcgi_script_name; } 

尝试改变

rewrite ^/beta/(.+)$ /beta/index.php?url=$1 break;

rewrite ^/beta/(.+)$ /beta/index.php?url=$1 last; break;

应该让nginx重新读取URI并相应地处理它。