ssl support

This commit is contained in:
Patrick 2024-11-13 18:40:36 +01:00
parent dcb2120c66
commit 9487c231a5
2 changed files with 16 additions and 1 deletions

View file

@ -5,6 +5,9 @@ build:
docker save -o $(APP).tar $(APP) docker save -o $(APP).tar $(APP)
install: install:
openssl genrsa -out /etc/ssl/private/$(APP).key 2048
openssl req -new -key /etc/ssl/private/$(APP).key -out /etc/ssl/certs/$(APP).csr
openssl x509 -req -in /etc/ssl/certs/$(APP).csr -CA /root/ca.crt -CAkey ca.key -CAcreateserial -out /etc/ssl/certs/$(APP).crt -days 500 -sha256
cp nginx /etc/nginx/sites-enabled/$(APP) cp nginx /etc/nginx/sites-enabled/$(APP)
docker load -i $(APP).tar docker load -i $(APP).tar
docker run -p 5000:5000 --name $(APP) --restart always -d $(APP) docker run -p 5000:5000 --name $(APP) --restart always -d $(APP)

14
nginx
View file

@ -1,10 +1,22 @@
server { server {
listen 80; listen 80;
server_name _; server_name jetsearch.com www.jetsearch.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name jetsearch.com www.jetsearch.com;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/private.key;
location / { location / {
proxy_pass http://127.0.0.1:5000; proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
} }
} }