鍍金池/ 問答/PHP  Python  Linux/ LNMP環(huán)境下,請問如何在啟用open_basedir的情況下,將入口定向到 r

LNMP環(huán)境下,請問如何在啟用open_basedir的情況下,將入口定向到 root/public ?

目前的解決方式是注釋掉 fastcgi.conf 文件中的 open_basedir=$document_root/:/tmp/:/proc/。但我覺得這樣不安全,所以特來求教。

用的是 Laravel 框架(5.5)。

這是 www.trip.uio.conf 文件的內(nèi)容,聽聞 Nginx 可以覆蓋變量,但不知道怎么操作:

server
    {
        listen 80;
        #listen [::]:80;
        server_name www.trip.uio trip.uio;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/www.trip.uio/public;

        include laravel.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/trip.log;
    }
回答
編輯回答
呆萌傻

可以在location里面增加如下一條配置試試:
fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/data/www/project/:/tmp/;

其中/data/www/project/為你項(xiàng)目目錄

2018年7月4日 23:46
編輯回答
喜歡你

可以添加.user.ini文件設(shè)置open_basedir
http://php.net/manual/zh/conf...

2018年6月13日 08:19