mirror of
https://github.com/M0r13n/mikrotik_monitoring.git
synced 2025-12-06 10:09:31 +00:00
simplify setup
This commit is contained in:
parent
6a1e1432b2
commit
9e1541e7b6
6 changed files with 22 additions and 38 deletions
26
README.md
26
README.md
|
|
@ -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`
|
`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:
|
Replace the content of `./nginx/nginx.conf` with:
|
||||||
- the private key: `./nginx/nginx-selfsigned.key`
|
|
||||||
- the certificate file `./nginx/nginx-selfsigned.crt`
|
|
||||||
|
|
||||||
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:
|
server {
|
||||||
- comment the line `./nginx/nginx.conf:/etc/nginx/conf.d/default.conf`
|
listen 443 ssl;
|
||||||
- and uncomment the four lines below
|
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/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,11 @@ services:
|
||||||
container_name: nginx
|
container_name: nginx
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
# Uncomment the four lines below to enable HTTPS
|
- ./nginx/nginx-selfsigned.key:/etc/nginx/ssl/nginx-selfsigned.key
|
||||||
# - ./nginx/nginx.conf.https:/etc/nginx/conf.d/default.conf
|
- ./nginx/nginx-selfsigned.crt:/etc/nginx/ssl/nginx-selfsigned.crt
|
||||||
# - ./nginx/nginx-selfsigned.key:/etc/nginx/ssl/nginx-selfsigned.key
|
- ./nginx/self-signed.conf:/etc/nginx/ssl/self-signed.conf
|
||||||
# - ./nginx/nginx-selfsigned.crt:/etc/nginx/ssl/nginx-selfsigned.crt
|
|
||||||
# - ./nginx/self-signed.conf:/etc/nginx/ssl/self-signed.conf
|
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 443:443
|
- 443:443
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
|
|
||||||
|
|
|
||||||
0
nginx/nginx-selfsigned.crt
Normal file
0
nginx/nginx-selfsigned.crt
Normal file
0
nginx/nginx-selfsigned.key
Normal file
0
nginx/nginx-selfsigned.key
Normal file
|
|
@ -1,7 +1,6 @@
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
root /usr/share/nginx/html;
|
listen [::]:80;
|
||||||
index index.html index.htm;
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://grafana:3000/;
|
proxy_pass http://grafana:3000/;
|
||||||
|
|
|
||||||
|
|
@ -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/;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue