[alibaba/tengine]配置多个 server 时,$document_root 不能全部生效

2024-05-15 183 views
9

系统: redhat 8 版本: tengine-2.3.2

配置多个 server 时,$document_root 不能全部生效

server {
    listen       80;
    server_name  a.com;

    root   /var/www/a.com/public;
    location / {
        index  index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^/(.*)  /index.php?$1 last;
        }
    }

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

回答

8

setenforce 0 就可以了