simplify setup

This commit is contained in:
Leon Morten Richter 2022-06-30 15:04:23 +02:00
parent 6a1e1432b2
commit 9e1541e7b6
No known key found for this signature in database
GPG key ID: 9903A6789FCE9468
6 changed files with 22 additions and 38 deletions

View file

@ -97,14 +97,24 @@ Generate a self signed certificate for your domain:
`sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./nginx/nginx-selfsigned.key -out ./nginx/nginx-selfsigned.crt`
This command generates two files:
- the private key: `./nginx/nginx-selfsigned.key`
- the certificate file `./nginx/nginx-selfsigned.crt`
Replace the content of `./nginx/nginx.conf` with:
Both files need to be mapped as a volume to `/etc/nginx/ssl/`.
```txt
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://$host$request_uri;
}
Then you also need to adjust the `docker-compose.yml` file:
- comment the line `./nginx/nginx.conf:/etc/nginx/conf.d/default.conf`
- and uncomment the four lines below
server {
listen 443 ssl;
listen [::]:443 ssl;
include ssl/self-signed.conf;
Finally you need to adjust the `nginx/nginx.conf.https` and adjust the `server_name` to your domain.
location / {
proxy_pass http://grafana:3000/;
}
}
```

View file

@ -58,14 +58,11 @@ services:
container_name: nginx
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
# Uncomment the four lines below to enable HTTPS
# - ./nginx/nginx.conf.https:/etc/nginx/conf.d/default.conf
# - ./nginx/nginx-selfsigned.key:/etc/nginx/ssl/nginx-selfsigned.key
# - ./nginx/nginx-selfsigned.crt:/etc/nginx/ssl/nginx-selfsigned.crt
# - ./nginx/self-signed.conf:/etc/nginx/ssl/self-signed.conf
- ./nginx/nginx-selfsigned.key:/etc/nginx/ssl/nginx-selfsigned.key
- ./nginx/nginx-selfsigned.crt:/etc/nginx/ssl/nginx-selfsigned.crt
- ./nginx/self-signed.conf:/etc/nginx/ssl/self-signed.conf
ports:
- 80:80
- 443:443
networks:
- default

View file

View file

View file

@ -1,7 +1,6 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html index.htm;
listen [::]:80;
location / {
proxy_pass http://grafana:3000/;

View file

@ -1,22 +0,0 @@
server {
listen 80;
server_name 192.168.0.10;
# Your domain
return 302 https://192.168.0.10;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
include ssl/self-signed.conf;
# Your domain
server_name 192.168.0.10;
location / {
proxy_pass http://grafana:3000/;
}
}