Improve NGINX reverse proxy setup instructions #971

Open
Anagastes wants to merge 6 commits from Anagastes/continuwuity:main into main
First-time contributor

Added NGINX example with Unix sockets. Helpful for newbies. I've struggled with this a lot, so here's to everyone now. :)

Added NGINX example with Unix sockets. Helpful for newbies. I've struggled with this a lot, so here's to everyone now. :)
docs/deploying/generic.md aktualisiert
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
6baa845274
Added NGINX example with Unix sockets. Helpful for newbies. I've struggled with this a lot, so here's to everyone now. :)
Owner

@Anagastes Are you planning to iterate on this further? If not we can review and propose merge once the WIP status is removed :)

@Anagastes Are you planning to iterate on this further? If not we can review and propose merge once the WIP status is removed :)
nex changed title from WIP: docs/deploying/generic.md changed to WIP: Improve NGINX reverse proxy setup instructions 2025-09-10 16:25:56 +00:00
Author
First-time contributor

Ah, I see. Yes, the process wasn't entirely clear yet :D

I'll do one last check and then remove the WIP.@nex wrote in #971 (comment):

@Anagastes Are you planning to iterate on this further? If not we can review and propose merge once the WIP status is removed :)

Ah, I see. Yes, the process wasn't entirely clear yet :D I'll do one last check and then remove the WIP.@nex wrote in https://forgejo.ellis.link/continuwuation/continuwuity/pulls/971#issuecomment-19761: > @Anagastes Are you planning to iterate on this further? If not we can review and propose merge once the WIP status is removed :)
Owner

No worries! I'm currently working on improving the issue/PR flows so they'll be clearer in future ^.^

No worries! I'm currently working on improving the issue/PR flows so they'll be clearer in future ^.^
Anagastes changed title from WIP: Improve NGINX reverse proxy setup instructions to Improve NGINX reverse proxy setup instructions 2025-09-10 17:08:41 +00:00
Anagastes force-pushed main from 7bbea1a88f
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
to 11a61d214e
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 50s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 5m33s
2025-09-10 17:08:49 +00:00
Compare
Anagastes force-pushed main from 11a61d214e
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 50s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 5m33s
to 4169f69e6b
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 38s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 11m16s
2025-09-10 18:43:46 +00:00
Compare
nex force-pushed main from 4169f69e6b
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 38s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 11m16s
to fa638c7951
All checks were successful
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 36s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 4m24s
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
2025-09-11 16:48:43 +00:00
Compare
nex requested review from nex 2025-09-11 16:48:49 +00:00
nex approved these changes 2025-09-17 21:03:32 +00:00
nex force-pushed main from fa638c7951
All checks were successful
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 36s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 4m24s
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
to e3f9fe2f34
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 49s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 5m1s
2025-09-17 21:03:35 +00:00
Compare
tcpipuk force-pushed main from d3fbbade64
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m4s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 5m16s
Release Docker Image / Build linux-amd64 (release) (pull_request) Successful in 5m47s
Release Docker Image / Build linux-arm64 (release) (pull_request) Successful in 5m58s
Release Docker Image / Create Multi-arch Release Manifest (pull_request) Successful in 4s
Release Docker Image / Build linux-amd64 (max-perf) (pull_request) Successful in 12m40s
Release Docker Image / Build linux-arm64 (max-perf) (pull_request) Successful in 12m37s
Release Docker Image / Create Max-Perf Manifest (pull_request) Successful in 10s
to 869c044059
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m45s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 11m48s
2025-09-23 06:52:23 +00:00
Compare
ginger force-pushed main from 869c044059
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m45s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 11m48s
to 333c029f84
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m27s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 6m1s
2025-10-13 13:06:24 +00:00
Compare
ginger added this to the 0.5.0 milestone 2025-10-13 13:06:37 +00:00
Owner

Going to merge this now, if you were going to add LK docs (looking at the reverted commit a few weeks ago) probably worth opening a followup PR

Going to merge this now, if you were going to add LK docs (looking at the reverted commit a few weeks ago) probably worth opening a followup PR
nex requested changes 2025-10-15 02:55:20 +00:00
nex left a comment
Owner

noticed a couple things on a final-pass look over

noticed a couple things on a final-pass look over
@ -168,0 +172,4 @@
Please note that your NGINX must have access to the socket.
In most cases, this is the **www-data** group. For consistency reasons, we change the systemd service.
Owner
- For security and performance reasons, we recommend Unix sockets with NGINX. 
+ For security and performance reasons, we recommend Unix sockets with NGINX, although plain port proxying is described later for convenience.

Something like this perhaps? nitpicking if anything

```diff - For security and performance reasons, we recommend Unix sockets with NGINX. + For security and performance reasons, we recommend Unix sockets with NGINX, although plain port proxying is described later for convenience. ``` Something like this perhaps? nitpicking if anything
Owner

or just 'For the best security and performance, you can use Unix sockets with NGINX. Alternatively, you can use normal TCP proxying'

or just 'For the best security and performance, you can use Unix sockets with NGINX. Alternatively, you can use normal TCP proxying'
@ -168,0 +203,4 @@
# Synapse-Server responses may be chunked, which is an HTTP/1.1 feature.
proxy_http_version 1.1;
}
```
Owner

The default value is 20M, perhaps the nginx config should reflect that?

The default value is 20M, perhaps the nginx config should reflect that?
Owner

Also we're not synapse, so the comment is off

Also we're not synapse, so the comment is off
@ -174,0 +216,4 @@
- `proxy_pass http://127.0.0.1:6167$request_uri;`
- `proxy_pass http://127.0.0.1:6167;`
Maybe you will check your conf bevor.
Owner

bevor -> before?

bevor -> before?
Owner

Actually maybe this should just be rephrased to
Make sure that your IP and port match that on which continuwuity is listening. Check your configuration if you aren't sure.

Actually maybe this should just be rephrased to `Make sure that your IP and port match that on which continuwuity is listening. Check your configuration if you aren't sure.`
nex requested changes 2025-10-15 03:04:02 +00:00
@ -168,0 +176,4 @@
```
User=conduwuit
Group=www-data
```
Owner
- Please note that your NGINX must have access to the socket.
-
- In most cases, this is the **www-data** group. For consistency reasons, we change the systemd service.
+ Please note that NGINX must have access to the socket. This is typically achieved by making sure the Unix socket is owned by the **www-data** group, so to achieve this we will update the systemd service.

General clarity here.

```diff - Please note that your NGINX must have access to the socket. - - In most cases, this is the **www-data** group. For consistency reasons, we change the systemd service. + Please note that NGINX must have access to the socket. This is typically achieved by making sure the Unix socket is owned by the **www-data** group, so to achieve this we will update the systemd service. ``` General clarity here.
Owner

Also, I'm not convinced making nginx and continuwuity share a group is a good idea, since the database is also group-readable, and this inherently increases the attack surface since now nginx will have the ability to completely read the database of continuwuity. Perhaps using something like ExecStartPost= to change the permissions of the socket itself to be more permissive (world writable? unsure what the implications on that are) is the more secure option that seems in-scope.

Also, I'm not convinced making nginx and continuwuity share a group is a good idea, since the database is also group-readable, and this inherently increases the attack surface since now nginx will have the ability to completely read the database of continuwuity. Perhaps using something like [`ExecStartPost=`](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#ExecStartPre=) to change the permissions of the socket itself to be more permissive (world writable? unsure what the implications on that are) is the more secure option that seems in-scope.
Owner

World-writable would have effectively the same security profile as network sockets AFAIK. I'm sure there's a better permissions-based solution

World-writable would have effectively the same security profile as network sockets AFAIK. I'm sure there's a better permissions-based solution
@ -174,0 +198,4 @@
}
location ~ ^(/|/_matrix|/_conduwuit) {
Owner

Haven't used nginx in a hot minute, but shouldn't this be inside the server block?

Haven't used nginx in a hot minute, but shouldn't this be inside the server block?
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m27s
Required
Details
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 6m1s
Required
Details
This pull request has changes requested by an official reviewer.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u main:Anagastes-main
git switch Anagastes-main
Sign in to join this conversation.
No reviewers
nex
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity!971
No description provided.