雖然我在django中有應用,但我想設(shè)置一個靜態(tài)頁面。使用 nginx。但我收到一個錯誤:[alert] 100983#0: *439266 "/path_to_page_on_server/press_page.htmlindex.html" is not a directory,這是我的網(wǎng)址: url(r'^press/', TemplateView.as_view(template_name='press_page.html'), name='press')這是我在 nginx 中的配置包括:location /press/ { alias /path_to_page_on_server/press_page.html;}我想下/press/有頁面press_page.html。
1 回答

達令說
TA貢獻1821條經(jīng)驗 獲得超6個贊
在 中nginx,您的index值被設(shè)置為index.html因此它被附加到alias-ed 位置。
您需要為index您的自定義文件指定,并將文件引用放入alias:
location /press/ {
alias /path_to_page_on_server/;
index press_page.html index.html;
}
最后一個index.html只是一個后備,你可以根據(jù)需要刪除/替換它。
添加回答
舉報
0/150
提交
取消