开发者

nginx rewrite rules to php files open a download dialog box? [closed]

开发者 https://www.devze.com 2023-03-30 07:46 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

I have a nginx server with work with php by fast cgi. when I use a rewrite like this:

rewrite "^/tested\.html" /index.html last;

everything is ok, and page index.html shown for tested.html, but when my target is a php file like this:

rewrite "^/tested\.html" /index.php last;

a download dialogbox is opened and when I save the file, I saw it开发者_如何学JAVA contain my php codes!!! anyone can help me?


NginX does not know how to execute PHP code, so instead your browser will just be given a text file with PHP in it.

Similarly to Apache where you need to install a module for PHP, on NginX, you need to install something like PHP FPM

0

精彩评论

暂无评论...
验证码 换一张
取 消