Skip to content

Commit bedfc09

Browse files
committed
nginx: allow custom nginx config under sites-enabled
fix 562
1 parent 3ce350d commit bedfc09

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## untagged
44

5+
- Allow custom nginx config files
6+
([#617](https://github.com/chatmail/relay/pull/617))
7+
58
- Check whether GCC is installed in initenv.sh
69
([#608](https://github.com/chatmail/relay/pull/608))
710

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,19 @@ This starts a local live development cycle for chatmail web pages:
255255

256256
- Starts a browser window automatically where you can "refresh" as needed.
257257

258+
#### Custom web pages
259+
260+
If you want to include other pages,
261+
they need their separate nginx config
262+
under `/etc/nginx/sites-enabled/`.
263+
Note that they need to listen on port 8443 instead of 443.
264+
265+
To request TLS certificates for the corresponding domains,
266+
point the DNS records to your Server and run `acmetool want <domain>`.
267+
You can find the TLS certificates under `/var/lib/acme/live`.
268+
They will be automatically renewed.
269+
270+
258271
## Mailbox directory layout
259272

260273
Fresh chatmail addresses have a mailbox directory that contains:

cmdeploy/src/cmdeploy/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,12 @@ def _configure_nginx(config: Config, debug: bool = False) -> bool:
424424
"""Configures nginx HTTP server."""
425425
need_restart = False
426426

427+
files.link(
428+
name="disable nginx default site",
429+
path="/etc/nginx/sites-enabled/default",
430+
present=False,
431+
)
432+
427433
main_config = files.template(
428434
src=importlib.resources.files(__package__).joinpath("nginx/nginx.conf.j2"),
429435
dest="/etc/nginx/nginx.conf",

cmdeploy/src/cmdeploy/nginx/nginx.conf.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,7 @@ http {
136136
return 301 $scheme://{{ config.domain_name }}$request_uri;
137137
access_log syslog:server=unix:/dev/log,facility=local7;
138138
}
139+
140+
# Include custom pages; they need to listen on port 8443 instead of port 443
141+
include /etc/nginx/sites-enabled/*;
139142
}

0 commit comments

Comments
 (0)