Skip to content

Commit

Permalink
added nginx reverse proxy (docker compose)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheminfolab committed Apr 6, 2024
1 parent 6d5bec9 commit c30103e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
33 changes: 31 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:

database:
container_name: eln_db
#restart: unless-stopped
# restart: unless-stopped
image: postgres:15.1
env_file: .backend.env
volumes:
Expand All @@ -16,7 +16,7 @@ services:

backend:
container_name: eln_backend
#restart: unless-stopped
# restart: unless-stopped
build:
context: ./backend
dockerfile: Dockerfile
Expand All @@ -32,6 +32,35 @@ services:
networks:
- eln

nginx:
container_name: nginx
image: nginx:1.23-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
# - ./certbot/conf:/etc/nginx/ssl
# - ./certbot/data:/usr/share/nginx/html/letsencrypt
depends_on:
- database
- backend
networks:
- eln

# certbot:
# container_name: certbot
# image: certbot/certbot:latest
# restart: unless-stopped
# # command: certonly --webroot --webroot-path=/usr/share/nginx/html/letsencrypt --email email@email.com --agree-tos --no-eff-email -d domain.com
# volumes:
# - ./certbot/conf:/etc/letsencrypt
# - ./certbot/data:/usr/share/nginx/html/letsencrypt
# - ./certbot/logs:/var/log/letsencrypt
# networks:
# - flask_eln

volumes:
eln_db:

Expand Down
9 changes: 9 additions & 0 deletions nginx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Testing the configuration:

```bash
docker compose exec nginx nginx -t
```
Restart Nginx:
```bash
docker compose exec nginx nginx -s reload
```
21 changes: 21 additions & 0 deletions nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
upstream api {
server eln_backend:8000;
}

server {
listen 80;
listen [::]:80;

# server_name

# letsencrypt challenge
# location ~ /.well-known/acme-challenge{
# allow all;
# root /usr/share/nginx/html/letsencrypt;
# }

location / {
proxy_set_header Host $host;
proxy_pass http://api/;
}
}

0 comments on commit c30103e

Please sign in to comment.