nginx php

disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server

 

删了proc方法

 

cat fastcgi.conf  ==open_dir 注释

 

#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/www/:/usr/local/bin:/home/www/cdspider2web:/root/.composer";

 

php.ini   注释

 

;open_basedir =/home/www/:/usr/local/bin:/home/www/cdspider2web:/root/.composer

 

  1. 在你php-fpm配置文件php-fpm.conf中设置security.limit_extensions 为 .php 或 .php5,或者其他任何与你环境一致的后缀名。 对于开发环境下的一些用户来说, 完全移除所有security.limit_extensions的值或设置为FALSE,能够保证可以正常工作.

     

  2. 在你的nginx配置文件中设置fastcgi_pass 为你的socket地址(e.g. unix:/var/run/php-fpm/php-fpm.sock;), 替代ip地址:端口这种方式(127.0.0.1:9000).

     

  3. 检查你的SCRIPT_FILENAMEfastcgi_param 并根据你文件的地址来设置它们.

  4. 在你的nginx配置文件中包含有fastcgi_split_path_info ^(.+\.php)(/.+)$; 则所有其他的对应fastcgi参数也都应该在location块中定义;具体可参考phalcon的nginx官方配置

  5. 在你的php.ini配置文件中,设置cgi.fix_pathinfo=1

[root@iZ2zec03srb2lqozivryfpZ vhost]# cat cdspider2web.conf
server {
    listen 8880;
    
    server_name 47.93.88.247;
    root "/home/www/cdspider2web/public";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log       /home/wwwlogs/cdspider2web_error.log;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/tmp/php-cgi.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        #fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
}

 

posted @ 2018-11-14 16:43  滴滴滴  阅读(225)  评论(0编辑  收藏  举报