Skip to content

Commit

Permalink
added nginx configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Flagro committed Nov 14, 2023
1 parent 7f4cdc9 commit 31c90ce
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
23 changes: 23 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
server {
listen 80;
server_name api.phrinifluent.com;

location /static/ {
alias /code/staticfiles/;
}

location / {
proxy_pass http://web:8000;
proxy_set_header Host $host;
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;
}

# SSL configuration
listen 443 ssl;
ssl_certificate /etc/ssl/certs/phrinifluent.crt;
ssl_certificate_key /etc/ssl/certs/phrinifluent.key;

# Further SSL options and optimizations can be added here
}
51 changes: 51 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.8'

services:
web:
build: .
command: gunicorn core.wsgi:application --bind 0.0.0.0:8000
volumes:
- .:/code
- static_volume:/code/staticfiles
env_file:
- .env.prod
depends_on:
- db
networks:
- internal

nginx:
image: nginx:1.21
ports:
- "80:80"
- "443:443"
volumes:
- static_volume:/code/staticfiles
- ./conf/nginx.conf:/etc/nginx/conf.d/default.conf
- /etc/ssl/certs/phrinifluent.crt:/etc/ssl/certs/phrinifluent.crt:ro
- /etc/ssl/certs/phrinifluent.key:/etc/ssl/certs/phrinifluent.key:ro
depends_on:
- web
networks:
- internal

db:
image: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
networks:
- internal

# Volumes
volumes:
postgres_data:
static_volume:

# Networks
networks:
internal:
driver: bridge

0 comments on commit 31c90ce

Please sign in to comment.