Richard Hart

Head of Something @ Somewhere
Kent, UK

My Music
My Photos

LinkedIn
Mastodon

Serve a static file on a specific URL in nginx

I recently had to serve a static file on a specific url in nginx. The requirement was that /sapm/jcb should show a specific page, but I of course forgot about the html extension so the end result was my file only appeared on /sapm/jcb.html.

An nginx conf change sorted it all out.

 
location /sapm/jcb { 
    try_files $uri $uri/ /sapm/jcb.html; 
}