Skip to content

Commit

Permalink
feat: add tls support
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablito2020 committed Oct 10, 2023
1 parent b3604fb commit b266a0f
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 4 deletions.
48 changes: 45 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: '3'
services:

postgres:
image: postgres:latest
environment:
Expand All @@ -13,7 +14,6 @@ services:
networks:
- backend

# Refuapp Backend
refuapp-backend:
build:
context: ./refuapp-backend # Path to your project directory
Expand All @@ -29,14 +29,56 @@ services:
networks:
- backend

swag:
image: lscr.io/linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Madrid
- URL=api.pofnet.net
- VALIDATION=http
- [email protected]
- PROD=true
volumes:
- /home/ferran/refuapp-deploy/nginx/site-confs:/config/nginx/site-confs
- /home/ferran/www/:/var/www
- /home/ferran/static/:/static
ports:
- 443:443
- 80:80
restart: unless-stopped
depends_on:
- refuapp-backend
networks:
- backend


networks:
backend:
driver: "bridge"

volumes:
postgres_data:
driver: local # Define the driver and options under the volume name
driver: local
driver_opts:
type: none
device: /home/ferran/data/
device: /home/ferran/data
o: bind
frontend_page:
driver: local
driver_opts:
type: none
device: /home/ferran/web
static_files:
driver: local
driver_opts:
type: none
device: /home/ferran/static
swag_config_files:
driver: local
driver_opts:
type: none
device: /home/ferran/refuapp-deploy
44 changes: 44 additions & 0 deletions nginx/site-confs/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Version 2023/06/05 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/site-confs/default.conf.sample

# redirect all traffic to https
server {
listen 80 default_server;
listen [::]:80 default_server;

location / {
return 301 https://$host$request_uri;
}
}

# main server block
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;

server_name _;

include /config/nginx/ssl.conf;

# root /config/www;
# index index.html index.htm index.php;

# enable subfolder method reverse proxy confs
# include /config/nginx/proxy-confs/*.subfolder.conf;

location /api {
rewrite ^/api/(.*) /$1 break;
proxy_set_header Host $http_host;
proxy_pass http://refuapp-backend:8000/;
}

# Root route
location / {
alias /var/www/;
index index.html;
}

# Static files
location /static {
alias /static/;
}
}

0 comments on commit b266a0f

Please sign in to comment.