Where can I put custom nginx conf that won't be overwritten?
-
As you said, this will eventually get overwritten and currently none of the apps are packaged in a way to allow them to run on subpaths of other apps. Usually apps require this knowledge for link sharing or links in transactional emails, so I guess you will hit other issues anyways.
I think the current only option is, to put a html meta redirect file at /blog which redirects to the ghost domain.
-
-
@nebulon OK thanks for this. Won't the redirect have to point to a different domain or subdomain though? I need them to share a root domain in order for the blog traffic to contribute to the static site's SEO.
https://re-public.io --> Surfer, static
https://re-public.io/blog --> Ghost -
@kaxline said in Where can I put custom nginx conf that won't be overwritten?:
Which gets overwritten quite often, at least once a day.
This shouldn't happen. The nginx config is only overwritten on a Cloudron update (and that too only if the update has any changes to nginx configuration). App updates also don't re-generate the nginx file. Maybe we have a bug somewhere but I have put some logs in my dev setup to see if this is reproducible here and what's causing this.
Note that every time, you do something that needs the app's container to be re-created, the nginx has to be re-generated. This is done because of the proxy_pass referencing the container by IP address. A container is recreated when you change it's location, email address, change storage, portbindings etc.
-
@kaxline said in Where can I put custom nginx conf that won't be overwritten?:
I need them to share a root domain in order for the blog traffic to contribute to the static site's SEO.
Not a SEO expert, so.. Is this a valid assumption that putting things in subdomains helps with SEO ?
(If it's a hypothesis, I guess that's fine too. Maybe we can try to add something on Cloudron side to allow subpaths to redirect to another app but this has security implications we have to think through like cookies/sessions/email notifications etc).
-
-
@kaxline have you tried separating out your changes out of the /etc/nginx/applications dir config file and into something like the sites-available dir in a separate config file?
Cloudron doesn't use that dir so it won't be overwriting it with any app updates.
-
@kaxline I think to properly support this, we can look into this for the next release. For the moment, I am still perplexed why those nginx configs are being overwritten everyday. I am not able to reproduce this here atleast.
Can you please try this:
- Edit some random nginx config file
- Add a dummy comment
- Can you report back tomorrow if that comment is still there? Or did it disappear?
-
Rather than trying to get Docker to do something it isn't usually tasked with doing (or perhaps within the Cloudron system), do these posts offer a possible alternative?:
https://cloak.ist/blog/how-to-put-a-ghost-blog-at-a-subdirectory-using-cloudflare-workers/
-
@girish OK, I chose a couple of the other app configs and added a comment. They were overwritten along with the Ghost config I originally was asking about. Any thoughts? Anything significant about the 5am/5pm PT time? Want me to test anything else? Send you some logs?
-
@scooke Yes! Thank you! I was looking at how to do this with Cloudflare right off the bat but couldn't find how to do it. Working now!
I would say this is less about Docker and more about Nginx. It would be nice to easily route subdirectory paths to different Cloudron apps via Nginx. Maybe in the UI there's a way to add a directory path in the Location panel.
Thanks again!
-
One can use the
include /path/...;
command for additional appX.conf filesI believe, you could use this configuration:
server { server_name example.com; listen [::]:80; listen 80; include /path/to/applications/*/nginx.conf; }
and then in each application's directory configure the redirection like this:
location /app1 { proxy_pass http://app1; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Request-Start $msec; }
-
@kaxline I found the issue! Can you please try this one-liner - https://git.cloudron.io/cloudron/box/-/commit/6839ff4cf60cb725d224619ee55bcf066a496a12 . The file to edit is
/home/yellowtent/box/src/reverseproxy.js
. After that, the nginx configs will not get overwritten everyday. -
-
-
-
-