我遇到了这个模块的问题,它一直告诉我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/;
}
}在文档中,根目录是文件,它就在那里。
发布于 2014-09-30 00:50:20
你在你的配置文件中提到根指令了吗?它为您的请求设置目录。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/;
}
}查看更多http://nginx.org/en/docs/http/ngx_http_core_module.html#root
https://stackoverflow.com/questions/26089885
复制相似问题