I don't know if lemmy supports sub-paths, I've never seen a lemmy hosted at one though. If it doesn't nginx definitely supports vhosts. So a single server/vm/container can definitely respond both at my.host.com and lemmy.host.com with appropriate content.
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
+1 to using a subdomain. You’ll probably have a much better time even if you get a path working.
It won’t work well. Other instances make assumptions about paths as it’s standardized. For example they don’t store the full pictrs path, just the ID. It’s assumed the path is /pictrs/image. You would have to set 301 redirects. Other instances may link directly to your root uri when making links back to you. The api requests are also likely going to your root uri.
The front end can do whatever you want. Just change the paths typescript files before you compile as those also use root urls.
I have my instance setup to use a CDN and separate URL for all static content including pictrs. I have a script that modifies the front end while compiling to accomplish this. I use 301 redirects to fix all the assumed paths and requests from other instances.
You might be able to setup a mod_rewrite rule to load a specific file path or other url based on the URL path, but a subdomain would probably be easier/cleaner.
From Apache mod_rewrite docs:
The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
Just remember the old adage about regular expressions: when you use a regular expression to try to solve one problem, you create two problems.
A subdomain would likely be cleaner and easier.
From a security point of view it is not a good idea to host multiple web applications in sub directories on the same hostname. With such a configuration, every application sees all cookies from all other applications. This also means that you can have collisions of cookie names between applications if the names are not unique.
So if one application would get compromised, it could easily steal all your sessions for all other applications.
Oh, I didn't think about that!