search

Home  >  Q&A  >  body text

php - Nginx 设置open_basedir跨站限制问题

我根据网上的提供的 Nginx配置的代码 在nginx 做了如下配置:

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

但是我发现 在Amazon EC2上设置就可,在腾讯云设置就不行 ,Amazon EC2 Lnmp环境用的是https://lnmp.org/一键环境包,腾讯云是自己编译安装的 。

phpinfo() 打印 Amazon EC 上的显示的open_basedir都是有值的 ,但是腾讯云上配置的 就全是 no value

但是在 php.ini中配置就可以,我实在想不明白明白了,改重启的也重启了。

难道是Nginx版本的问题? Amazon的Nginx版本是 1.10 , 腾讯云的Nginx版本是 1.12。

習慣沉默習慣沉默2751 days ago711

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 12:05:05

    nginx:

    set php open_basedir

    fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; (The following directories can be set by yourself, such as open_basedir=/home/wwww/:/tmp/, etc.)

    php:
    Restricted directory: open_basedir =/var/www/sina/:/var/www/wangyi/:/var/www/logs/session/. If it is apache, you can use php_admin_value open_basedir to limit

    These are the standard, correct settings. If the relevant VPS cloud is not working, it should be because of the server, it is restricted or something happened.

    reply
    0
  • Cancelreply