Skip to content

Commit 9a51a7e

Browse files
committed
added nginx implementation
1 parent 5e58078 commit 9a51a7e

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
lines changed

.github/templates/README.template.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,30 @@ And add secure Token(s) to `api.tokens`. See [API TOKENs](#api-tokens).
5757
5858
### Reverse Proxy
5959

60+
##### Traefik
61+
6062
Take a look at the [traefik](https://github.com/traefik/traefik) implementation:
6163

6264
```yaml
63-
{ { file.examples/traefik.docker-compose.yaml } }
65+
{ { file.examples/traefik/traefik.docker-compose.yaml } }
66+
```
67+
68+
#### NGINX Proxy
69+
70+
This is the [NGINX](https://github.com/nginx/nginx) `docker-compose.yaml` file:
71+
72+
```yaml
73+
{ { file.examples/nginx/nginx.docker-compose.yaml } }
6474
```
6575

76+
Create a `nginx.conf` file in the `docker-compose.yaml` folder and mount it to `etc/nginx/conf.d/default.conf`:
77+
78+
```conf
79+
{ { file.examples/nginx/nginx.conf } }
80+
```
81+
82+
Lastly add your `cert.key` and `cert.crt` into your `certs/` folder and mount it to `/etc/nginx/ssl`.
83+
6684
## Setup
6785

6886
Before you can send messages via Secured Signal API you must first set up [Signal rAPI](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md)
@@ -137,7 +155,7 @@ you have to add `@` in front of any KeyValue Pair assignment.
137155

138156
Supported types include **strings**, **ints** and **arrays**. See [Formatting](#string-to-type).
139157

140-
## Security: Best Practices
158+
## Best Practices
141159

142160
- Always use API tokens in production
143161
- Run behind a TLS-enabled [Reverse Proxy](#reverse-proxy) (Traefik, Nginx, Caddy)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
server {
2+
# Allow SSL on Port 443
3+
listen 443 ssl;
4+
5+
# Add allowed hostnames which nginx should respond to
6+
# `_` for any
7+
server_name localhost;
8+
9+
ssl_certificate /etc/nginx/ssl/cert.crt;
10+
ssl_certificate_key /etc/nginx/ssl/cert.key;
11+
12+
location / {
13+
# Use whatever network alias you set in the docker-compose file
14+
proxy_pass http://secured-signal-api:8880;
15+
proxy_set_header Host $host;
16+
proxy_set_header X-Real-IP $remote_addr;
17+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
18+
proxy_set_header X-Forwarded-Host $host;
19+
proxy_set_header X-Fowarded-Proto $scheme;
20+
}
21+
}
22+
23+
# Redirect HTTP to HTTPs
24+
server {
25+
listen 80;
26+
server_name localhost;
27+
return 301 https://$host$request_uri;
28+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
services:
2+
secured-signal:
3+
image: ghcr.io/codeshelldev/secured-signal-api:latest
4+
container_name: secured-signal-api
5+
environment:
6+
API__URL: http://signal-api:8080
7+
SETTINGS__VARIABLES__RECIPIENTS: "[+123400002,+123400003,+123400004]"
8+
SETTINGS__VARIABLES__NUMBER: "+123400001"
9+
API__TOKENS: "[LOOOOOONG_STRING]"
10+
restart: unless-stopped
11+
networks:
12+
backend:
13+
aliases:
14+
- secured-signal-api
15+
16+
nginx:
17+
image: nginx:latest
18+
container_name: secured-signal-proxy
19+
volumes:
20+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
21+
# Load SSL certificates: cert.key, cert.crt
22+
- ./certs:/etc/nginx/ssl
23+
ports:
24+
- "443:443"
25+
- "80:80"
26+
restart: unless-stopped
27+
networks:
28+
frontend:
29+
backend:
30+
31+
networks:
32+
backend:
33+
frontend:

0 commit comments

Comments
 (0)