When using Flarum in a subfolder with nginx, you might need to define two try blocks, one for the main application, and one for Flarum.
That's what I use on one website where Flarum is hosted at /forum:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /forum/ {
try_files $uri $uri/ /forum/index.php?$query_string;
}
This assumes you followed https://docs.flarum.org/install.html#customizing-paths to remove the public folder. Don't forget to also update the location block that protects sensitive files (add /forum prefix):
location ~* ^/forum/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor|workbench) {
deny all;
return 404;
}