I have a static site and I'm trying to remove the .html from the url, so when I visit the site www.example.com/home.html I should get: www.example.com/home.
This is my project structure:
project
docker
nginx
conf.d
default.conf
www
index.html
home.html
services.html
docker-compose.yml
This is the docker-compose.yml file:
version: '3.6'
services:
my-app:
container_name: trasauto_nginx
image: nginx:stable-alpine
restart: always
volumes:
- "./www/:/usr/share/nginx/html"
- ./docker/nginx/conf.d/:/etc/nginx/conf.d
expose:
- 80
networks:
default:
external:
name: proxy
and this is the default.conf:
server {
try_files $uri.html $uri $uri/ =404;
}
I tried to remove the .html part from the url, but for some reason I get:
404 not found
what I did wrong?