Nginx behid traefik reach 404

Hello :slight_smile:

I'm trying to host simple static file server, and i find this solution:


I also tried on origin nginx without any good result.
Also with this guide:

Nginx without traefik work nice, i want to use traefik because i really need https, and simple url without port. Maybe here is other solution which i can use.

Anyway here is my docker-compose:

fileServer:
  image: flashspys/nginx-static
  container_name: {myDomain.org}
  expose:
    - 180/tcp
  ports:
    - 180:180
  labels:
    - "traefik.enable=true"
    - "trefik.docker.network=traefik_default"         
    - "traefik.http.routers.nginxrouter.rule=Host(`myDomain.org`)"
    - "traefik.http.routers.nginxrouter.entrypoints=web"
    - "traefik.http.servives.nginxrouter.loadbalancer.server.port=180"
    - "traefik.http.routers.nginxrouter.redirect@file"
    - "traefik.http.routers.nginxroutersecured.rule=Host(`myDomain.org`)"
    - "traefik.http.routers.nginxroutersecured.tls=true"
    - "traefik.http.routers.nginxroutersecured.entrypoints=websecure"
    - "traefik.http.routers.nginxrouter.tls.certresolver=myresolver"
  volumes:
    - /absolute/path/to/staticFiles:/static    

Below i have default.conf file (changed port from 80 to 180 because traefik listen on port 80):

server {
listen 180;
server_name localhost;
location / {
root /static;
index index.html index.htm;
}
}

I always get 404 when try to reach:
http:// myDomain.org /fileName.test //with space because this url exist :smiley:
https://myDomain.org/fileName.jpg

I host other services on traefik (about 10 container) and everything work perfect.

Just a typo error ? servives

@cakiwi Thanks a lot, but in my case problem was caused by network config.

Below is my configFile:

1 Like