nginx php扩展名 替换 出现Access denied.解决

想把 .asmx  当 .php  来执行,出现 Access denied. 错误。


location ~ [^/]\.asmx(/|$)
#location ~ .*\.(php|asmx)?$
        {
            # comment try_files $uri =404; to enable pathinfo
            try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            #include pathinfo.conf;
        }


修改:/usr/local/php/etc/php-fpm.conf  在后面加上一行:security.limit_extensions = .php .asmx .html .js .css .jpg .jpeg .gif .png .htm


[global]

pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice


[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 20
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 20
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log

security.limit_extensions = .php .asmx .html .js .css .jpg .jpeg .gif .png .htm



说明:从5.3.9开始,php官方加入了一个配置"security.limit_extensions",默认状态下只允许执行扩展名为".php"的文件,造成了其他类型的文件不支持的问题。

你可能感兴趣的:(nginx php扩展名 替换 出现Access denied.解决)