Nginx config for __PATH__?

I’ve been working on packaging archivebox for yunohost. I’m getting close to working - the app installs and works properly when I install it to the root path of a domain / .

But when I install to a subpath, e.g. /example , then I get an error when I visit the page " Not Found. The requested resource was not found on this server."

This is my nginx config:

location __PATH__/ {

  # Force usage of https
  if ($scheme = http) {
     rewrite ^ https://$server_name$request_uri? permanent;
  }

  proxy_set_header Accept-Encoding "";
  try_files $uri @proxy;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

location @proxy {
  proxy_pass http://127.0.0.1:__PORT__;
  proxy_set_header   Host $host;
  proxy_set_header   X-Real-IP $remote_addr;
  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header   X-Forwarded-Host $server_name;
  proxy_set_header X-Forwarded-Proto https;
  proxy_set_header Proxy "";
  proxy_pass_header Server;
}

I’m not sure the best practice for getting nginx to pass the requests to the subpath to the underlying proxied app correctly (http://127.0.0.1:PORT). anyone have any tips?

Here is my full repo: https://github.com/mhfowler/archivebox_ynh

Serving Archivebox through sub-path doesn’t seem easy as per this issue…

@ericg interesting. is it considered ok to package a yunohost app without this possibility and to require the / domain for an app? or is it a blocking issue?

It is not a blocking issue. Lots of apps only serve root domain only actually.

1 Like