diff --git a/src/nginxconfig.ejs b/src/nginxconfig.ejs index f05fde07c..098db3ae6 100644 --- a/src/nginxconfig.ejs +++ b/src/nginxconfig.ejs @@ -28,6 +28,12 @@ server { alias /home/yellowtent/platformdata/acme/; } + location /notfound.html { + root <%= sourceDir %>/dashboard/dist; + try_files /notfound.html =404; + internal; + } + # for default server, serve the notfound page. for other endpoints, redirect to HTTPS location / { <% if ( endpoint === 'admin' || endpoint === 'setup' ) { %> @@ -37,8 +43,8 @@ server { <% } else if ( endpoint === 'redirect' ) { %> return 301 https://<%= redirectTo %>$request_uri; <% } else if ( endpoint === 'ip' ) { %> - root <%= sourceDir %>/dashboard/dist; - try_files /notfound.html =404; + root /home/yellowtent/boxdata; + try_files /custom_pages/notfound.html /notfound.html; <% } %> } } @@ -277,9 +283,15 @@ server { # to clear a permanent redirect on the browser return 302 https://<%= redirectTo %>$request_uri; <% } else if ( endpoint === 'ip' ) { %> - location / { - root <%= sourceDir %>/dashboard/dist; + location /notfound.html { + root <%= sourceDir %>/dashboard/dist; try_files /notfound.html =404; + internal; + } + + location / { + root /home/yellowtent/boxdata; + try_files /custom_pages/notfound.html /notfound.html; } <% } %> }