1

Although I have the application in django, I want to set up a static page. Using nginx. But I get an error:

[alert] 100983#0: *439266 "/path_to_page_on_server/press_page.htmlindex.html" is not a directory,

Here is my url: url(r'^press/', TemplateView.as_view(template_name='press_page.html'), name='press')

Here is my config in nginx include:

location /press/ { alias /path_to_page_on_server/press_page.html; }

I would like to under /press/ have page press_page.html.

user9192656
  • 549
  • 3
  • 16

1 Answers1

1

In nginx, your index value is set as index.html hence it is being appened to the alias-ed location.

You need to specify the index to your custom file, and also drop the file reference in alias:

location /press/ {
    alias /path_to_page_on_server/;
    index press_page.html index.html;
}

The last index.html is just a fallback, you can drop/replace it if you want.

heemayl
  • 39,294
  • 7
  • 70
  • 76
  • Thanks for your answer. Now my path in error.log lopks like `/path_to_page_on_server/press_page.htmlpress_page.html`. Double `press_page.html`. I removed also `index.html`. – user9192656 Feb 15 '19 at 17:32
  • Aren't you using `nginx` only? Does the request route to `django` also? Whats your actual `/path_to_page_on_server/`? – heemayl Feb 15 '19 at 17:35
  • sorry I made mistake, everything is perfect. thanks a lot, you made my weekend :) – user9192656 Feb 15 '19 at 17:36
  • 1
    @user9192656 No problem. Enjoy your weekend :) – heemayl Feb 15 '19 at 17:37