NGINX:.php 中的 add_before_body

NGINX:.php 中的 add_before_body
worker_processes 8;

events {
    worker_connections 1024;
}

http {
    gzip off;
    root htdocs;
    add_before_body subsites/dropletlocal/library/global/func-global.class.php; #DOESN'T
    add_before_body subsites/dropletlocal/library/global/test.html; #WORKS
    include mime.types;
    include web-hosting/*.conf;
}

您好,我尝试使用 .php 文件实现 add_before_body 函数,但它给出了错误“未指定输入文件”。此外,当我使用 .html 文件时,它会正常包含它。我非常感谢任何帮助。

例如.conf;

server {
    listen       80;
    server_name  ***.es.vc;
    location / {
        root   htdocs/subsites/***;
        index  index.php;
    }
    location ~ \.php$ {
        root   htdocs/subsites/***;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

相关内容