Apache
Want to use Apache as your reverse proxy? Then your in luck you've come to the right place!
Prerequisites
Before moving on you must have
- some knowledge of Apache
- valid SSL certificates
Installation
To implement Apache in front of Secured Signal API you need to update your docker-compose.yaml file.
services:
secured-signal:
image: ghcr.io/codeshelldev/secured-signal-api:latest
container_name: secured-signal
environment:
API__URL: http://signal-api:8080
SETTINGS__MESSAGE__VARIABLES__RECIPIENTS: "[+123400002, +123400003, +123400004]"
SETTINGS__MESSAGE__VARIABLES__NUMBER: "+123400001"
API__TOKENS: "[LOOOOOONG_STRING]"
restart: unless-stopped
networks:
backend:
aliases:
- secured-signal-api
apache:
image: httpd:latest
container_name: apache
ports:
- "80:80"
- "443:443"
volumes:
- ./apache.conf:/usr/local/apache2/conf/httpd.conf:ro
- ./certs:/etc/ssl
networks:
proxy:
backend:
ipv4_address: 172.20.0.100
networks:
backend:
proxy:
Setup
Create a apache.conf file in the docker-compose.yaml folder and mount it to /usr/local/apache2/conf.d in your Apache container.
<VirtualHost *:443>
ServerName domain.com
# SSL Configuration
SSLEngine on
SSLCertificateFile /etc/ssl/cert.crt
SSLCertificateKeyFile /etc/ssl/cert.key
# Proxy settings
ProxyPreserveHost On
# Use whatever network alias you set in the docker-compose file
ProxyPass / http://sec-signal-api:8880
ProxyPassReverse / http://sec-signal-api:8880
</VirtualHost>
# Redirect HTTP to HTTPS
<VirtualHost *:80>
ServerName domain.com
Redirect permanent / https://domain.com/
</VirtualHost>
Add your cert.key and cert.crt into your certs/ folder and mount it to /etc/ssl.
Configuration
Now you can switch over to Secured Signal API and add Apache to your trusted proxies:
settings:
access:
trustedProxies:
- 172.20.0.100
Lastly spin up your stack:
docker compose up -d
And you are ready to go!