Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Where can I put custom nginx conf that won't be overwritten?

Where can I put custom nginx conf that won't be overwritten?

Scheduled Pinned Locked Moved Solved Support
reverseproxynginx
21 Posts 5 Posters 3.7k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • robiR robi

    @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.

    kaxlineK Offline
    kaxlineK Offline
    kaxline
    wrote on last edited by
    #10

    @robi I haven't tried that because I'm not sure where to put it in order to have it overwrite the default Cloudron configs. Any suggestions on that? Thanks!

    girishG robiR 2 Replies Last reply
    0
    • kaxlineK kaxline

      @robi I haven't tried that because I'm not sure where to put it in order to have it overwrite the default Cloudron configs. Any suggestions on that? Thanks!

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #11

      @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?
      kaxlineK 1 Reply Last reply
      2
      • kaxlineK kaxline

        @robi I haven't tried that because I'm not sure where to put it in order to have it overwrite the default Cloudron configs. Any suggestions on that? Thanks!

        robiR Offline
        robiR Offline
        robi
        wrote on last edited by
        #12

        @kaxline there should be an nginx doc somewhere that describes the order in which it loads configs from different directories.

        Conscious tech

        1 Reply Last reply
        1
        • scookeS Offline
          scookeS Offline
          scooke
          wrote on last edited by
          #13

          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/

          https://www.indiehackers.com/product/img-vision/ghost-blog-is-now-hosted-on-main-domain--M6Gt3CSAp3nIFeZKOC-

          A life lived in fear is a life half-lived

          kaxlineK 1 Reply Last reply
          1
          • girishG girish

            @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?
            kaxlineK Offline
            kaxlineK Offline
            kaxline
            wrote on last edited by
            #14

            @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?

            girishG 1 Reply Last reply
            0
            • scookeS scooke

              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/

              https://www.indiehackers.com/product/img-vision/ghost-blog-is-now-hosted-on-main-domain--M6Gt3CSAp3nIFeZKOC-

              kaxlineK Offline
              kaxlineK Offline
              kaxline
              wrote on last edited by
              #15

              @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!

              girishG 1 Reply Last reply
              1
              • kaxlineK kaxline

                @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?

                girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #16

                @kaxline To give some update here, I put the comment in some of our internal cloudrons. I can confirm that in some of them the nginx configs are overwritten. I will investigate as to why.

                1 Reply Last reply
                0
                • robiR Offline
                  robiR Offline
                  robi
                  wrote on last edited by
                  #17

                  One can use the include /path/...; command for additional appX.conf files

                  I 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;
                  }
                  

                  Conscious tech

                  1 Reply Last reply
                  1
                  • kaxlineK kaxline

                    @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!

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #18

                    @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.

                    kaxlineK 1 Reply Last reply
                    2
                    • girishG girish

                      @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.

                      kaxlineK Offline
                      kaxlineK Offline
                      kaxline
                      wrote on last edited by
                      #19

                      @girish I ended up going with a Cloudflare script, which feels a little cleaner for now. I'll try this when I revisit the issue. Thanks for all your help!

                      robiR 1 Reply Last reply
                      1
                      • kaxlineK kaxline

                        @girish I ended up going with a Cloudflare script, which feels a little cleaner for now. I'll try this when I revisit the issue. Thanks for all your help!

                        robiR Offline
                        robiR Offline
                        robi
                        wrote on last edited by
                        #20

                        @kaxline can you kindly share your script?

                        We have other Cloudflare users here who may benefit from your experience. 😄

                        Conscious tech

                        kaxlineK 1 Reply Last reply
                        2
                        • girishG girish has marked this topic as solved on
                        • P Prinzhorn referenced this topic on
                        • robiR robi

                          @kaxline can you kindly share your script?

                          We have other Cloudflare users here who may benefit from your experience. 😄

                          kaxlineK Offline
                          kaxlineK Offline
                          kaxline
                          wrote on last edited by
                          #21

                          @robi Yes, sorry, I just followed the tutorial that was previously posted by @scooke

                          https://cloak.ist/blog/how-to-put-a-ghost-blog-at-a-subdirectory-using-cloudflare-workers/

                          1 Reply Last reply
                          1
                          • kaxlineK kaxline referenced this topic on
                          • E eganonoa referenced this topic on
                          • E eganonoa referenced this topic on
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Bookmarks
                          • Search