nginx 中到静态页面的错误路径
Wrong path in nginx to static page
虽然我在django中有应用,但我想设置一个静态页面。使用 nginx。但是我得到一个错误:
[alert] 100983#0: *439266 "/path_to_page_on_server/press_page.htmlindex.html" is not a directory,
这是我的 url:
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
页。
在 nginx
中,您的 index
值设置为 index.html
,因此它被附加到 alias
编辑的位置。
您需要将 index
指定为您的自定义文件,并将文件引用拖放到 alias
:
location /press/ {
alias /path_to_page_on_server/;
index press_page.html index.html;
}
最后一个index.html
只是一个后备,如果你想的话可以drop/replace。
虽然我在django中有应用,但我想设置一个静态页面。使用 nginx。但是我得到一个错误:
[alert] 100983#0: *439266 "/path_to_page_on_server/press_page.htmlindex.html" is not a directory,
这是我的 url:
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
页。
在 nginx
中,您的 index
值设置为 index.html
,因此它被附加到 alias
编辑的位置。
您需要将 index
指定为您的自定义文件,并将文件引用拖放到 alias
:
location /press/ {
alias /path_to_page_on_server/;
index press_page.html index.html;
}
最后一个index.html
只是一个后备,如果你想的话可以drop/replace。