lemmy
lemmy copied to clipboard
Add Apache and Caddy config templates
I was looking for webserver sample .conf files but it seems there's only one for nginx. Would it be possible to make more for other webservers?
Thanks.
Here's a starting point for Caddy - I haven't been able to test it because I'm trying to run the docker-compose on a Pi4 and I can't find an ARM64 build for iFramely, but it should save you some work at least.
Note that it requires Caddy 2.1 since it uses handle_path
:
lemmy.yourdomain.com {
import common
route {
@pictshare {
path_regexp img /pictshare/(.*)
}
redir @pictshare /pictrs/image/{http.regexp.img.1} permanent
handle_path /pictrs/* {
reverse_proxy /image pictrs:8080
respond 403
}
reverse_proxy /iframely iframely:80
reverse_proxy lemmy:8536
}
}
where common
is a snippet of default settings I use:
(common) {
log {
output file /data/logs/caddy.log
}
encode gzip
header {
-Server
Strict-Transport-Security "max-age=31536000; include-subdomains;"
X-XSS-Protection "1; mode=block"
X-Frame-Options "DENY"
X-Content-Type-Options nosniff
Referrer-Policy no-referrer-when-downgrade
X-Robots-Tag "none"
}
}
Lemmy should also work without iframely, it will just be unable to generate link previews. We could also make the iframely URL configurable, then you could use dev.lemmy.ml/iframely
.
I'll re-open if anyone works on / starts adding these.
Hello, I am also trying to run Lemmy and Caddy. But I don't know how? Can anyone help me
We won't support any server but nginx, but if anyone wants to submit templates for others, feel free to. I'll leave this open.
We won't support any server but nginx, but if anyone wants to submit templates for others, feel free to. I'll leave this open.
Okay, that does it, I wanted to run my own instance but this single comment convinced me otherwise. Not only you cannot resolve !2201 by the single fix I "invented" today (which prevents me from building from sources) but also the official freaking docu on "Install with Docker" says plainly: "Make sure you have both docker and docker-compose(>=1.24.0) installed". And guess what? Then you use "restart: always" which yields an error and was fixed somewhere in 2.x.y. BYE LEMMY, I'M DONE
(caddy-common) {
encode gzip
header {
-Server
Strict-Transport-Security "max-age=31536000; include-subdomains;"
X-XSS-Protection "1; mode=block"
X-Frame-Options "DENY"
X-Content-Type-Options nosniff
Referrer-Policy no-referrer-when-downgrade
X-Robots-Tag "none"
}
}
lemmy-site.com {
import caddy-common
reverse_proxy http://lemmy_lemmy-ui_1:1234
}
@lemmy {
path /api/*
path /pictrs/*
path /feeds/*
path /nodeinfo/*
path /.well-known/*
}
@lemmy-hdr {
header Accept application/*
}
handle @lemmy {
reverse_proxy http://lemmy_lemmy_1:8536
}
handle @lemmy-hdr {
reverse_proxy http://lemmy_lemmy_1:8536
}
@lemmy-post {
method POST
}
handle @lemmy-post {
reverse_proxy http://lemmy_lemmy_1:8536
}
seems to be working
@nycterent Could you please make a pull request to add it to the documentation?
(caddy-common) { encode gzip header { -Server Strict-Transport-Security "max-age=31536000; include-subdomains;" X-XSS-Protection "1; mode=block" X-Frame-Options "DENY" X-Content-Type-Options nosniff Referrer-Policy no-referrer-when-downgrade X-Robots-Tag "none" } } lemmy-site.com { import caddy-common reverse_proxy http://lemmy_lemmy-ui_1:1234 } @lemmy { path /api/* path /pictrs/* path /feeds/* path /nodeinfo/* path /.well-known/* } @lemmy-hdr { header Accept application/* } handle @lemmy { reverse_proxy http://lemmy_lemmy_1:8536 } handle @lemmy-hdr { reverse_proxy http://lemmy_lemmy_1:8536 } @lemmy-post { method POST } handle @lemmy-post { reverse_proxy http://lemmy_lemmy_1:8536 }
seems to be working
This isn't for caddy 2 though, right?
i am using it with v2.6.4. are you having any issues with it?
On Sat, Jun 17, 2023 at 4:59 PM paulo-roger @.***> wrote:
(caddy-common) { encode gzip header { -Server Strict-Transport-Security "max-age=31536000; include-subdomains;" X-XSS-Protection "1; mode=block" X-Frame-Options "DENY" X-Content-Type-Options nosniff Referrer-Policy no-referrer-when-downgrade X-Robots-Tag "none" } } lemmy-site.com { import caddy-common reverse_proxy http://lemmy_lemmy-ui_1:1234 }
@lemmy { path /api/* path /pictrs/* path /feeds/* path /nodeinfo/* path /.well-known/* }
@lemmy-hdr { header Accept application/* }
handle @lemmy { reverse_proxy http://lemmy_lemmy_1:8536 }
handle @lemmy-hdr { reverse_proxy http://lemmy_lemmy_1:8536 }
@lemmy-post { method POST }
handle @lemmy-post { reverse_proxy http://lemmy_lemmy_1:8536 }
seems to be working
This isn't for caddy 2 though, right?
— Reply to this email directly, view it on GitHub https://github.com/LemmyNet/lemmy/issues/819#issuecomment-1595780061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATZ3KXPZBAPAXJVHPYBHDXLXA57ANCNFSM4OABNTZA . You are receiving this because you were mentioned.Message ID: @.***>
i am using it with v2.6.4. are you having any issues with it? … On Sat, Jun 17, 2023 at 4:59 PM paulo-roger @.> wrote: (caddy-common) { encode gzip header { -Server Strict-Transport-Security "max-age=31536000; include-subdomains;" X-XSS-Protection "1; mode=block" X-Frame-Options "DENY" X-Content-Type-Options nosniff Referrer-Policy no-referrer-when-downgrade X-Robots-Tag "none" } } lemmy-site.com { import caddy-common reverse_proxy http://lemmy_lemmy-ui_1:1234 } @lemmy { path /api/ path /pictrs/ path /feeds/ path /nodeinfo/* path /.well-known/* } @lemmy-hdr { header Accept application/* } handle @lemmy { reverse_proxy http://lemmy_lemmy_1:8536 } handle @lemmy-hdr { reverse_proxy http://lemmy_lemmy_1:8536 } @lemmy-post { method POST } handle @lemmy-post { reverse_proxy http://lemmy_lemmy_1:8536 } seems to be working This isn't for caddy 2 though, right? — Reply to this email directly, view it on GitHub <#819 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATZ3KXPZBAPAXJVHPYBHDXLXA57ANCNFSM4OABNTZA . You are receiving this because you were mentioned.Message ID: @.***>
yes, I get the following error:
Job for caddy.service failed because the control process exited with error code. See "systemctl status caddy.service" and "journalctl -xe" for details.
Error: adapting config using caddyfile: cannot define a matcher outside of a site block: '@lemmy'
try this:
lemmy-site.com {
import caddy-common
reverse_proxy http://lemmy_lemmy-ui_1:1234
@lemmy {
path /api/*
path /pictrs/*
path /feeds/*
path /nodeinfo/*
path /.well-known/*
}
@lemmy-hdr {
header Accept application/*
}
handle @lemmy {
reverse_proxy http://lemmy_lemmy_1:8536
}
handle @lemmy-hdr {
reverse_proxy http://lemmy_lemmy_1:8536
}
@lemmy-post {
method POST
}
handle @lemmy-post {
reverse_proxy http://lemmy_lemmy_1:8536
}
}
Yeah! Only thing I had to change was reverse_proxy localhost:1234
Thank you very much!
Hi @nycterent I recently had a problem with an user uploading huge pics, I have just learned I can limit it in caddy.
I just added this
lemmy-site.com {
import caddy-common
reverse_proxy localhost:1234
# Adding max size upload to 256kb
request_body {
max_size 256KB
}
...
good idea ;)
On Fri, Jun 30, 2023 at 12:45 AM paulo-roger @.***> wrote:
Hi @nycterent https://github.com/nycterent I recently had a problem with an user uploading huge pics, I have just learned I can limit it in caddy.
I just added this
lemmy-site.com { import caddy-common reverse_proxy localhost:1234
Adding max size upload to 256kb
request_body { max_size 256KB }
...
— Reply to this email directly, view it on GitHub https://github.com/LemmyNet/lemmy/issues/819#issuecomment-1613890696, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATZ3MFENA3EB5XGX44OGTXNYAQLANCNFSM4OABNTZA . You are receiving this because you were mentioned.Message ID: @.***>
try this:
lemmy-site.com { import caddy-common reverse_proxy http://lemmy_lemmy-ui_1:1234 @lemmy { path /api/* path /pictrs/* path /feeds/* path /nodeinfo/* path /.well-known/* } @lemmy-hdr { header Accept application/* } handle @lemmy { reverse_proxy http://lemmy_lemmy_1:8536 } handle @lemmy-hdr { reverse_proxy http://lemmy_lemmy_1:8536 } @lemmy-post { method POST } handle @lemmy-post { reverse_proxy http://lemmy_lemmy_1:8536 } }
What is the difference between this one and the one before that? The latter has the @ -handle clauses inside the lemmy-site specification, while the former does not. How do these two differ in their operations?
if i remember correctly - non working one had issues with missing curly bracket. the fixed version also has improved formatting
@nycterent can you clarify which Caddyfile you mean "non working" and which "fixed" ?
@nycterent can you clarify which Caddyfile you mean "non working" and which "fixed" ?
sorry - https://github.com/LemmyNet/lemmy/issues/819#issuecomment-1595823157 is working one.
These would live in the lemmy-docs repo, not here.