Php http_添加_模块Nginx
我发现这个模块有问题,它一直告诉我404找不到Php http_添加_模块Nginx,php,nginx,Php,Nginx,我发现这个模块有问题,它一直告诉我404找不到 server { listen 80; server_name domain.com; location / { add_before_body $document_root/test.txt; proxy_redirect off; proxy_buffering off; proxy_pass http://IP/; } } 在文档中
server {
listen 80;
server_name domain.com;
location / {
add_before_body $document_root/test.txt;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://IP/;
}
}
在文档中,root是文件,它显然就在那里。您在配置文件中提到root指令了吗?它为您的请求设置目录。Nginx将$uri追加到此目录并提供文件
server{
listen 80;
server_name domain.com;
#e.g
root /var/www; #" the directory where test.txt exists.
location /{
add_before_body test.txt;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://IP/;
}
}
看更多