首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >http_addition_module Nginx

http_addition_module Nginx
EN

Stack Overflow用户
提问于 2014-09-29 05:32:18
回答 1查看 713关注 0票数 0

我遇到了这个模块的问题,它一直告诉我404找不到,

代码语言:javascript
复制
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/;
    }
}

在文档中,根目录是文件,它就在那里。

EN

回答 1

Stack Overflow用户

发布于 2014-09-30 00:50:20

你在你的配置文件中提到根指令了吗?它为您的请求设置目录。Nginx将$uri附加到此目录,并将提供该文件。

代码语言:javascript
复制
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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26089885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档