2014-09-28 27 views
0

我遇到的這個模塊的麻煩,它不斷告訴我找不到404,http_addition_module Nginx的

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/; 
    } 
} 

在文檔根目錄文件,它的挑釁那裏。

回答

0

你是否在你的配置文件中提到了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/; 
    } 
} 

查看更多 http://nginx.org/en/docs/http/ngx_http_core_module.html#root