Static HTML site not displaying CSS

1. Output of caddy version:

Latest Docker version

2. How I run Caddy:

Self-host via Docker on own server

a. System environment:

Docker

b. Command:

docker compose up caddy

c. Service/unit/compose file:

  caddy:
    image: caddy
    container_name: caddy
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - ${APPDATA}/caddy/Caddyfile:/etc/caddy/Caddyfile
      - ${APPDATA}/caddy/site:/srv
      - ${APPDATA}/caddy/data:/data
      - ${APPDATA}/caddy/config:/config
    networks:
      - caddy

d. My complete Caddy config:

jordan.me {
    
  route /blog* {
  	
    reverse_proxy ghost:2368
	
  }
  
  route /about* {
    
	root * /srv/landing-page
	try_files index.html
	encode gzip
	file_server
	
  }
  
}

3. The problem I’m having:

I have a domain at which I currently serve a Ghost blog via Docker on the ‘/blog’ route. I’m also working on a personal landing page where I’d like to use a template from HTML5up to serve a static HTML site w/ relevant info.

I’ve saved the landing page folder (which includes index.html as well as associated style sheets) into Caddy’s ‘srv’ folder and referenced it as so in my Caddyfile (above).

When I load the page (jordan.me/about), only the text from my index.html file is displayed. There isn’t any associated CSS.

4. Error messages and/or full log output:

No log errors

5. What I already tried:

I’ve tried multiple combinations of the following directives already:

  • root *
  • try files
  • file_server

6. Links to relevant resources:

Relevant HTML5 UP theme: https://html5up.net/dimension

Your page doesn’t DNS resolve for me rn, so I can’t see it for myself :woman_shrugging:

Try handle (Caddyfile directive) — Caddy Documentation and handle_path (Caddyfile directive) — Caddy Documentation instead of route (Caddyfile directive) — Caddy Documentation and maybe turn on logs and check your http status code in your browser

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.