I'm using Nginx as reverse proxy and I can successfully access Joplin server via http://myRaspi:22300. But I'd like to host it under https://myRaspi/joplinServer with a redirect to http://myRaspi:22300. Nginx is already configured to serve https://myRaspi.
First, in your .env only your url should be present:
APP_BASE_URL=https://myRaspi/joplinServer (without the port)
Second, you shouldn't tinker with the docker compose file, so you shouldn't edit the APP_BASE_URL value there, as it will be relayed by the .env file (thus, should simply be by default, - APP_BASE_URL=${APP_BASE_URL}).
Last, in your Nginx config, the proxy pass should look like this: http://127.0.0.1:22300
Also in Nginx, a few headers should be present, such as: proxy_set_header X-Forwarded-Host $host; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_pass_header Content-Type;
This should get you going as these are the working settings on a "production" server.
This is rather weird, as I've helped many users here set up their own servers so it would have to work with all these infos, but let me give you my own actual settings so it may give you ideas.
.env (the relevant part, other than this I have only the db password and the mailing module set up): APP_BASE_URL=https://joplin.domain.com
docker-compose.yml: default, didn't change a thing here as everything comes from the environment file
Reverse proxy (Nginx)(only the relevant information from the config):
Now I have the same settings as you, except the subresource. Maybe somebody could confirm whether this is even possible?
Any other option is possible as well - I'm running a Raspberry Pi 4 behind a FritzBox - so if creating a subdomain is an option (I'm not familiar to that), any hints would be appreciated
It looks like the proxy server is not just directing the request to http://127.0.0.1:22300 it is also appending joplinServer to the end, making the full request http://127.0.0.1:22300/joplinServer. Joplin Server has no such path so you get the error. Whether you can reverse proxy these requests in a manner that prevents this is beyond me!! I had a try and failed...
If your FritzBox does not allow you to create custom dns entries you could build a Pi-Hole and tell the FritzBox to use that for DNS lookups. You can then use the Pi-Hole GUI to use custom, non-internet domains / subdomains on your network.
If you use an .env file for the Joplin environment settings you do not need an environment section in the Joplin part of the docker-compose.yml file. The Postgres db environment variables are unlikely to change and so can stay in the compose file. Using an .env file means you can make changes to Joplin settings whilst leaving the main compose file well alone.
docker-compose.yml (for a sub-domain setup)
Not sure if the port 465:465 mapping is needed for setting up the server email but I did it and it worked.
This contains some Joplin environment variables you can play with if you want. The extra ones are mainly for setting up the Joplin server's email system but ACCOUNT_TYPES_ENABLED=1 would allow you to set users up with the equivalent default quotas / settings of basic and pro accounts. It's a while since I last "toggled" some of these so I can only assume that they still work. When it comes to the mailer security settings, search this forum for mailer_security for help, if needed.
Does Joplin Server have no possibility to say "Hey, you're running under this subresource?" I know this from ASP.NET Core, where I can say app.UsePathBase("/joplinServer");
I think that the problem lies with the nginx setup and not Joplin as what you are asking for is basically the Joplin Server base path environment variable. It's just that nginx adds to it.
Try this:
In your .env file set APP_BASE_URL=https://myRaspi/joplinServer as well as any other variables.
or forget the .env file and just use the docker-compose file.
The trailing slashes after joplinServer in the server block location section appear to be important.
When I do that on my test system if I type just the url without /joplinServer I get sent to the default nginx welcome page. However if I add /joplinServer I get sent to the server login page.
I will let you test if you can still sync with this server after all this abuse!!