Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
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

agnos.is Forums

  1. Home
  2. Selfhosted
  3. Having trouble with my caddy congif for my lemmy instance

Having trouble with my caddy congif for my lemmy instance

Scheduled Pinned Locked Moved Selfhosted
selfhosted
11 Posts 8 Posters 0 Views
  • 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.
  • ? Guest

    I have a lemmy instance running but I'm having trouble with my reverse proxy config. I'm using Caddy. Previously I had used nginx but didn't end up keeping the instance alive. Now I want to get it back up but I've since switched to Caddy because it's just easier. I have several self hosted services already working great with caddy and don't want to disrupt that.

    I've found a few configs online but none seem to work. I'm running this on a standard ubuntu server 22.04 box.

    Any ideas or suggestions?

    X This user is from outside of this forum
    X This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #2

    The biggest issue I have with Caddy and running ancillary services as some services attempt to utilize port 80 and/or 443 (and may not be configurable), which of course isn't possible because Caddy monopolizes those ports. The best solution to this I've found is to migrate Caddy and my services to docker containers and adding them all to the same "caddy" network.

    With your caddy instance still monopolizing port 80 and 443, you can use the Docker expose or port parameters to allow your containers to utilize port 80 and/or 443 from within the container, but proxify it on the host network. This is what my caddy config looks like;

    {
            admin 127.0.0.1:2019
            email {email}
            acme_dns cloudflare {token}
    }
    domain.dev, domain.one {
            encode zstd gzip
            redir https://google.com/
    }
    *.domain.dev, *.domain.one {
            encode zstd gzip
            @book host bk.domain.dev bk.domain.one
            handle @book {
                    reverse_proxy linkding:9090
            }
            @git host git.domain.dev git.domain.one
            handle @git {
                    reverse_proxy rgit:8000
            }
            @jelly host jelly.domain.dev jelly.domain.one
            handle @jelly {
                    reverse_proxy {ip}:8096
            }
            @status host status.domain.dev status.domain.one
            handle @status {
                    reverse_proxy status:3000
            }
            @wg host wg.domain.dev wg.domain.one
            handle @wg {
                    reverse_proxy wg:51820
            }
            @ping host ping.domain.dev ping.domain.one
            handle @ping {
                    respond "pong!"
            }
    }
    

    It works very well.

    A E I 3 Replies Last reply
    0
    • ? Guest

      I have a lemmy instance running but I'm having trouble with my reverse proxy config. I'm using Caddy. Previously I had used nginx but didn't end up keeping the instance alive. Now I want to get it back up but I've since switched to Caddy because it's just easier. I have several self hosted services already working great with caddy and don't want to disrupt that.

      I've found a few configs online but none seem to work. I'm running this on a standard ubuntu server 22.04 box.

      Any ideas or suggestions?

      J This user is from outside of this forum
      J This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #3

      We'll need to see configs and IP assignments to be able to help.

      1 Reply Last reply
      0
      • X [email protected]

        The biggest issue I have with Caddy and running ancillary services as some services attempt to utilize port 80 and/or 443 (and may not be configurable), which of course isn't possible because Caddy monopolizes those ports. The best solution to this I've found is to migrate Caddy and my services to docker containers and adding them all to the same "caddy" network.

        With your caddy instance still monopolizing port 80 and 443, you can use the Docker expose or port parameters to allow your containers to utilize port 80 and/or 443 from within the container, but proxify it on the host network. This is what my caddy config looks like;

        {
                admin 127.0.0.1:2019
                email {email}
                acme_dns cloudflare {token}
        }
        domain.dev, domain.one {
                encode zstd gzip
                redir https://google.com/
        }
        *.domain.dev, *.domain.one {
                encode zstd gzip
                @book host bk.domain.dev bk.domain.one
                handle @book {
                        reverse_proxy linkding:9090
                }
                @git host git.domain.dev git.domain.one
                handle @git {
                        reverse_proxy rgit:8000
                }
                @jelly host jelly.domain.dev jelly.domain.one
                handle @jelly {
                        reverse_proxy {ip}:8096
                }
                @status host status.domain.dev status.domain.one
                handle @status {
                        reverse_proxy status:3000
                }
                @wg host wg.domain.dev wg.domain.one
                handle @wg {
                        reverse_proxy wg:51820
                }
                @ping host ping.domain.dev ping.domain.one
                handle @ping {
                        respond "pong!"
                }
        }
        

        It works very well.

        A This user is from outside of this forum
        A This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #4

        How are you doing your certs with this set up?

        X 1 Reply Last reply
        0
        • X [email protected]

          The biggest issue I have with Caddy and running ancillary services as some services attempt to utilize port 80 and/or 443 (and may not be configurable), which of course isn't possible because Caddy monopolizes those ports. The best solution to this I've found is to migrate Caddy and my services to docker containers and adding them all to the same "caddy" network.

          With your caddy instance still monopolizing port 80 and 443, you can use the Docker expose or port parameters to allow your containers to utilize port 80 and/or 443 from within the container, but proxify it on the host network. This is what my caddy config looks like;

          {
                  admin 127.0.0.1:2019
                  email {email}
                  acme_dns cloudflare {token}
          }
          domain.dev, domain.one {
                  encode zstd gzip
                  redir https://google.com/
          }
          *.domain.dev, *.domain.one {
                  encode zstd gzip
                  @book host bk.domain.dev bk.domain.one
                  handle @book {
                          reverse_proxy linkding:9090
                  }
                  @git host git.domain.dev git.domain.one
                  handle @git {
                          reverse_proxy rgit:8000
                  }
                  @jelly host jelly.domain.dev jelly.domain.one
                  handle @jelly {
                          reverse_proxy {ip}:8096
                  }
                  @status host status.domain.dev status.domain.one
                  handle @status {
                          reverse_proxy status:3000
                  }
                  @wg host wg.domain.dev wg.domain.one
                  handle @wg {
                          reverse_proxy wg:51820
                  }
                  @ping host ping.domain.dev ping.domain.one
                  handle @ping {
                          respond "pong!"
                  }
          }
          

          It works very well.

          E This user is from outside of this forum
          E This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #5

          Caddy does not need 80 and 443. I've changed them to unprivileged ports like 8000 and 8443.

          Besides, op doesn't mention having problems with ports

          X 1 Reply Last reply
          0
          • ? Guest

            I have a lemmy instance running but I'm having trouble with my reverse proxy config. I'm using Caddy. Previously I had used nginx but didn't end up keeping the instance alive. Now I want to get it back up but I've since switched to Caddy because it's just easier. I have several self hosted services already working great with caddy and don't want to disrupt that.

            I've found a few configs online but none seem to work. I'm running this on a standard ubuntu server 22.04 box.

            Any ideas or suggestions?

            irmadlad@lemmy.worldI This user is from outside of this forum
            irmadlad@lemmy.worldI This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #6

            I'm not sure if this will help you out since I'm really not sure what your problems are other than getting the reverse proxy to work. So, I'll give you what I've found to work and if it's not what you were looking for then you can just skip over what I"m yammering on about.

            The process:

            Spin up a container, let's say it's Dozzle and it needs port 1124. Container deployed, so lets put it in reverse proxy:

            Issue command together:

            sudo nano /etc/caddy/Caddyfile
            sudo systemctl restart caddy	
            

            Enter the following in the Caddyfile:

            dozzle.myverycooldomain.duckdns.org:443 {
            	reverse_proxy localhost:1124
            }
            

            Press ctrl x, press y, press enter, and the Caddy server restarts if you indeed issued the commands together. Now go to dozzle.myverycooldomain.duckdns.org for test run.

            1 Reply Last reply
            0
            • X [email protected]

              The biggest issue I have with Caddy and running ancillary services as some services attempt to utilize port 80 and/or 443 (and may not be configurable), which of course isn't possible because Caddy monopolizes those ports. The best solution to this I've found is to migrate Caddy and my services to docker containers and adding them all to the same "caddy" network.

              With your caddy instance still monopolizing port 80 and 443, you can use the Docker expose or port parameters to allow your containers to utilize port 80 and/or 443 from within the container, but proxify it on the host network. This is what my caddy config looks like;

              {
                      admin 127.0.0.1:2019
                      email {email}
                      acme_dns cloudflare {token}
              }
              domain.dev, domain.one {
                      encode zstd gzip
                      redir https://google.com/
              }
              *.domain.dev, *.domain.one {
                      encode zstd gzip
                      @book host bk.domain.dev bk.domain.one
                      handle @book {
                              reverse_proxy linkding:9090
                      }
                      @git host git.domain.dev git.domain.one
                      handle @git {
                              reverse_proxy rgit:8000
                      }
                      @jelly host jelly.domain.dev jelly.domain.one
                      handle @jelly {
                              reverse_proxy {ip}:8096
                      }
                      @status host status.domain.dev status.domain.one
                      handle @status {
                              reverse_proxy status:3000
                      }
                      @wg host wg.domain.dev wg.domain.one
                      handle @wg {
                              reverse_proxy wg:51820
                      }
                      @ping host ping.domain.dev ping.domain.one
                      handle @ping {
                              respond "pong!"
                      }
              }
              

              It works very well.

              I This user is from outside of this forum
              I This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #7

              You can use caddy-l4 to redirect some traffic before (or after) tls and to different ports and hosts depending on FQDN.

              Though that is still experimental.

              X 1 Reply Last reply
              0
              • ? Guest

                I have a lemmy instance running but I'm having trouble with my reverse proxy config. I'm using Caddy. Previously I had used nginx but didn't end up keeping the instance alive. Now I want to get it back up but I've since switched to Caddy because it's just easier. I have several self hosted services already working great with caddy and don't want to disrupt that.

                I've found a few configs online but none seem to work. I'm running this on a standard ubuntu server 22.04 box.

                Any ideas or suggestions?

                hitagi@ani.socialH This user is from outside of this forum
                hitagi@ani.socialH This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #8

                Have you tried the Caddyfile from Lemmy-Easy-Deploy?

                1 Reply Last reply
                0
                • I [email protected]

                  You can use caddy-l4 to redirect some traffic before (or after) tls and to different ports and hosts depending on FQDN.

                  Though that is still experimental.

                  X This user is from outside of this forum
                  X This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #9

                  Well that's dope... Didn't know that was a thing.

                  1 Reply Last reply
                  0
                  • E [email protected]

                    Caddy does not need 80 and 443. I've changed them to unprivileged ports like 8000 and 8443.

                    Besides, op doesn't mention having problems with ports

                    X This user is from outside of this forum
                    X This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #10

                    Caddy does not need 80 and 443.

                    By default and all measurable expectation it does. Unless you can't use privileged HTTP/HTTPS ports, there's no real reason to use unprivileged ports.

                    Besides, op doesn’t mention having problems with ports

                    OP said he was having issues, and this is a common issue I've had. Since he was non-descript as to what the issues were, it's really not stupid to mention it.

                    1 Reply Last reply
                    0
                    • A [email protected]

                      How are you doing your certs with this set up?

                      X This user is from outside of this forum
                      X This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #11

                      Caddy manages everything, including certs for both domains. So I guess my answer would be, you don't.

                      1 Reply Last reply
                      0
                      • System shared this topic on
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups