Custom 404 for my_webapp

My YunoHost server

Hardware: VPS bought online
YunoHost version:
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Hello good people,

I have setup a simple static website using my_webapp and it works well except that I can’t get custom error messages. I tried multiple methods: editing the nginx config for that specific domain and also a .htaccess file inside the root of the app, and I still get the default nginx error messages. There are WordPress installations on the same server as well and they have normal error handling. Any idea what could be the issue?


I’d read this How to Create Custom 404 Error Page in NGINX

and then customized it to my_webapp (I have several, so I made per-site configs and error pages). Basically:

  • create a custom 404.html file in the root directory of your my_webapp
  • edit /etc/nginx/conf.d/domain.tld.d/my_webapp.conf (this file is refered in the include of your domain.tld.conf file)
  • add there this config at the bottom (anywhere)
        # error 404
error_page 404 /404.html;
location = /404.html {
        root /var/www/my_webapp/www/;

404.html is the name of MY error page
root is where your webapp is served from
internal is for making it accesible only from an actual error request

this way you can customize any error (403, 500, etc)


Ahhh man, I tried that exact config but didn’t put it outside the last }
Works perfectly, thanks for clarifying :)))

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.