最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nginx - Setup self-managed Firefly III server in subdirectory - Stack Overflow

programmeradmin3浏览0评论

I am trying to install a Firefly III instance on a machine which already has web services running. Therefore I want to serve it in the subdirectory firefly. Unfortunately I don't get it running after first installation. My nginx configuration currently looks like this:

location ^~ /firefly {
  alias [...]/firefly-iii/public/;
  index index.php;

  if (!-e $request_filename) { rewrite ^ /firefly-iii/public/index.php last; }

  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass php-handler;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  }
}

The startup page seems to work correctly (I had issues there with my first trials, too), and now I get redirected from /firefly to /firefly/login. But there I get a 404 File not found error.

Is there any documentation about my particular use-case? I could not find any documentation about the webserver configuration other than the side-note "You can look up for your webserver (Apache or nginx) how to change the root directory".

Edit: I found the following snippet in the FAQs and replaced my current approach with it (commented-out commands are replaced with the values matching my configuration):

location ^~ /budget {
  alias [...]/firefly-iii/public;
  try_files $uri $uri/ @budget;

  location ~* \.php(?:$|/) {
    #include snippets/fastcgi-php.conf;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
    #fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    fastcgi_pass unix:/var/run/php-fpm.sock;
  }
}
location @budget {
  rewrite ^/budget/(.*)$ /budget/index.php/$1 last;
}

This gives me a slightly different result. Now I get a custom Firefly III 404 page, stating "Firefly III cannot find this page". But it seems that assets like CSS files and images are not fetched correctly. They are searched at the root instead of the budget subdirectory and thus cannot be found either. Does the subdirectory need to be configured in Firefly as well?

发布评论

评论列表(0)

  1. 暂无评论