[infra] Import the base nginx service definition we use (#1127)
This commit is contained in:
commit
efe6a5a713
2 changed files with 40 additions and 0 deletions
21
infra/services/nginx/README.md
Normal file
21
infra/services/nginx/README.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Nginx
|
||||
|
||||
This is a base nginx service that terminates TLS, and can be used as a reverse
|
||||
proxy for arbitrary services by adding new entries in `/root/nginx/conf.d` and
|
||||
`sudo systemctl restart nginx`.
|
||||
|
||||
## Installation
|
||||
|
||||
Create a directory to house service specific configuration
|
||||
|
||||
sudo mkdir -p /root/nginx/conf.d
|
||||
|
||||
Add the SSL certificate provided by Cloudflare
|
||||
|
||||
sudo tee /root/nginx/cert.pem
|
||||
sudo tee /root/nginx/key.pem
|
||||
|
||||
## Adding a service
|
||||
|
||||
When adding new services that sit behind nginx, add their nginx conf file to
|
||||
`/root/nginx/conf.d` and and restart the nginx service.
|
19
infra/services/nginx/nginx.service
Normal file
19
infra/services/nginx/nginx.service
Normal file
|
@ -0,0 +1,19 @@
|
|||
[Unit]
|
||||
Documentation=https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=docker pull nginx
|
||||
ExecStartPre=-docker stop nginx
|
||||
ExecStartPre=-docker rm nginx
|
||||
ExecStart=docker run --name nginx \
|
||||
--add-host=host.docker.internal:host-gateway \
|
||||
-p 443:443 \
|
||||
-v /root/nginx/cert.pem:/etc/ssl/certs/cert.pem:ro \
|
||||
-v /root/nginx/key.pem:/etc/ssl/private/key.pem:ro \
|
||||
-v /root/nginx/conf.d:/etc/nginx/conf.d:ro \
|
||||
nginx
|
Loading…
Add table
Reference in a new issue