NGINX-将html文件映射到php

NGINX-将html文件映射到php,php,html,nginx,mapping,fastcgi,Php,Html,Nginx,Mapping,Fastcgi,我无法让nginx读取嵌入在特定目录html/test的.html文件中的php代码。我运行CentOS 6并安装了FastCGI。我已经尝试了几种配置,但都没有效果。我的nginx.conf如下所示: worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream;

我无法让nginx读取嵌入在特定目录html/test的.html文件中的php代码。我运行CentOS 6并安装了FastCGI。我已经尝试了几种配置,但都没有效果。我的nginx.conf如下所示:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;


    keepalive_timeout  65;

    server {

        server_name www.domain.com;
        rewrite ^(.*) http://domain.com$1 permanent;


    } 
    server {
        listen 80;
        server_name shop-munk.com *.shop-munk.com;


        location / {
            root   /opt/html;
            index  index.html index.htm index.php;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /opt/html;
        }


        location ~ \.php$ {
            root           opt/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /$fastcgi_script_name;
            include        fastcgi_params;
        }

    location ~ \.html$ {
            root           opt/html/test;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.html;
            fastcgi_param  SCRIPT_FILENAME  /$fastcgi_script_name;
            include        fastcgi_params;
    }


    }


}

我试图做同样的事情,服务器返回403禁止脚本没有.php扩展名。 以下PHP-FPM配置修复了该问题:

security.limit_extensions = .php .html

我试图做同样的事情,服务器返回403禁止脚本没有.php扩展名。 以下PHP-FPM配置修复了该问题:

security.limit_extensions = .php .html