Wondering if it is possible to customize the 404 page displayed for a dokku app.
For example, if example.my-domain.com is a working nginx app, can I point example.my-domain.com/nonsense-url-that-is-not-there to something like example.my-domain.com/404.html?
nginx v1.6.2 dokku v0.2.3
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You could edit your vhost to use a 404 page. Edit a vhost something like this:
server{
server_name www.foo.com;
root /srv/www/foo/public_html;
expires 1M;
access_log /srv/www/foo/logs/access.log;
error_log /srv/www/foo/logs/error.log;
error_page 404 /404.html;
location / {
index index.html;
rewrite ^/(.*)/$ /$1 permanent;
try_files "${uri}.html" $uri $uri/ =404;
}
location = /404.html {
internal;
}
}
Thanks. My version of dokku is 0.2.3, looks like this functionality was added in 0.3.10. I will update and then try this!
For others who might find this: https://github.com/progrium/dokku/blob/master/docs/nginx.md#customizing-the-nginx-configuration
Allright, to customize the nginx template in use for the myapp application, create a file at /home/dokku/<appname>/nginx.conf.template with the default contents.
Edit this file to your needs, so use your custom 404 page error etc.
After your changes a dokku deploy <myapp> will regenerate the /home/dokku/<appname>/nginx.conf file which is then used.
I hope this will work for you
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.