NGINX不会将.php5parsing为.php

我已经用ISPconfig安装了nginx。 一切工作正常,除了一些网站,我已经从Apache服务器移植不幸有.php5扩展名,我不知道如何让Nginxparsing它们。 我已经尝试了许多解决scheme和变体,但仍然无法使其工作。

我会从文件中粘贴我的设置,如果有人有类似的经验,想分享,我会感激。

部分来自文件的设置: /etc/php5/fpm/php.ini

cgi.fix_pathinfo = 0

在/ etc / nginx的/网站可用/默认

 服务器{
        听80 default_server;
        根/ usr / share / nginx / html;
         index index.html index.php index.htm;
        位置 / {
                 try_files $ uri $ uri / /index.html;
         }
 }
位置〜\ .php $ {
         #fastcgi_split_path_info ^(。+ \。php)(/.+)$;
         ##注意:你应该有“cgi.fix_pathinfo = 0;” 在php.ini中
         #
         #单独使用php5-cgi:
         #fastcgi_pass 127.0.0.1:9000;
         #用php5 -fpm:
         #fastcgi_pass unix:/var/run/php5-fpm.sock;
         #fastcgi_index index.php;
         #fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
         #include fastcgi_params;
                 try_files $ uri = 404;
                 fastcgi_pass unix:/var/run/php5-fpm.sock;
                 fastcgi_index index.php;
                 fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
                包括fastcgi_params;
         }

具有错误的特定域的Vhostconfiguration文件:

 位置〜\ .php $ {
             try_files /58c4be432bbd2af65343c142b9ec45ec.htm @php;
         }


        位置@php {
             try_files $ uri = 404;
            包括/ etc / nginx / fastcgi_params;
             fastcgi_pass 127.0.0.1:9048;
             fastcgi_index index.php;
             fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
             fastcgi_intercept_errors on;
         }

        位置 / {
                 try_files $ uri $ uri / /index.php?q=$uri&$args;
         } 

/etc/php5/fpm/pool.d/www.conf已取消注释:

  security.limit_extensions = .php .php3 .php4 .php5 

当有人访问该.php5页面(网站有超过500反向链接)浏览器开始下载,如php-fpm不parsing.php5文件:

  “/ Mozilla / 5.0(Windows NT 6.3; WOW64)AppleWebKit / 537.36( KHTML,像Gecko)Chrome / 33.0.1750.117 Safari / 537.36“
 38.104.70.230  -   -  [26 / Feb / 2014:22:54:27 +0000]“GET /index.php5 HTTP / 1.1”200 71941“ - ”“Mozilla / 5.0(Windows NT 6.3; WOW64; rv:27.0)壁虎/ 20100101 Firefox / 27.0“
 66.233.7.113  -   -  [26 / Feb / 2014:22:56:43 +0000]“GET /sitemap.php5 HTTP / 1.1”200 71941“ - ”“Mozilla / 5.0(Windows NT 6.3; WOW64; rv:27.0)壁虎/ 20100101 Firefox / 27.0“ 

我如何设置nginx来parsing.php5页面如.php?

先谢谢你。

如果你使每一行:

location ~ \.php$ { 

看起来像:

  location ~ \.(php|php5)$ { 

它应该做你想要的。 单独留下@php行(@php是一个内部块)。 当然,这个正则expression式可能会更短,但是不太清楚。

还有

在你的位置@php块传递给套接字而不是本地主机:

  fastcgi_pass unix:/var/run/php5-fpm.sock;