Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx site specific 404 pages #1531

Closed
ghost opened this issue Mar 10, 2019 · 2 comments
Closed

nginx site specific 404 pages #1531

ghost opened this issue Mar 10, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 10, 2019

I'm trying to figure out how to get nginx to display the 404.html in a specific sites root.

If entered directly, i.e. domain.tld/404.html it works of course but hitting any non existent url it renders the default nginx error page.

I tried adding an error_page directive under the default server config for nginx and restarted the service with no luck. Specifically error_page 404 /404.html as per http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page. Both in the server block and the location block.

Is there a way to enable this already that I'm missing? I know MIAB is not intended to be a complex web server but having even a default to attempt a /404.html before the default would be pretty awesome.

@doofpot
Copy link
Contributor

doofpot commented Mar 27, 2019

when you create a site, you have a subdirectory "domain.tld"
In the same directory, you create domain.tld.conf; in this file, you can add directives as from the above nginx link.

If they are not duplicate, it will work.

items below will probably work.
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

after modifieng the .conf file, you only have to do nginx -t (for testing the config file) and systemctl restart nginx.service for loading a correct config file

@ghost
Copy link
Author

ghost commented Mar 29, 2019

cool, thank you @doofpot

@ghost ghost closed this as completed Mar 29, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant