nginx web服务器index.php下载

我有麻烦让我的index.php页面打开。 相反,我把它作为一个随机命名的下载链接。 我的configuration非常接近默认。

服务器{

listen 80; root /path/to/html/docs; index index.php; location / { autoindex on; try_files $uri $uri/ /index.php; } 

}

我曾尝试closuresnginx.conf中的sendfile,并将文本/ php添加到应用程序的gzip列表中,但无济于事。

nginx不处理php文件,所以你必须把它传递给一个php解释器来生成响应。 推荐的方法是使用php-fpm(PHP FastCGI进程pipe理器): https : //www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/