[2.x] Serve /favicon.ico through Flarum in the nginx config shipped with flarum/flarum

Open Beginner friendly
#5,320 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
nginx, php
Domain
backend, devops

Research direction

Read .nginx.conf and locate the static file regex location block that currently handles .ico requests. Add the exact /favicon.ico location shown in the issue before the other location blocks, then check that its try_files directive passes missing files to /index.php with the query string. Done means nginx can route /favicon.ico to Flarum.

Written by the indexing model from the issue text.

Description

flarum/framework#5319 adds a /favicon.ico route that redirects to the forum's icon, for crawlers and feed readers that ask for it without reading the page.

The nginx config shipped in flarum/flarum (.nginx.conf) has a regex location for static files, including .ico, with no fallback to index.php. nginx answers /favicon.ico with a 404 before Flarum sees it. Apache and LiteSpeed already pass it to Flarum through .htaccess.

Once #5319 is merged, add this to flarum/flarum's .nginx.conf, before the other location blocks:

location = /favicon.ico {
  try_files $uri /index.php?$query_string;
}

Existing installs keep their own config. flarum/docs#693 documents the line for them.

Dominant language
PHP
Stars
6.8k
Forks
892
Avg merge
1d 1h
Merged PRs (30d)
209

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flarum/framework

All issues in flarum/framework

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.