-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Flagro/nginx_production
Nginx production
- Loading branch information
Showing
7 changed files
with
136 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
DEBUG=True | ||
ENVIRONMENT=development | ||
SECRET_KEY="YOUR DJANGO KEY" | ||
DB_NAME=postgres | ||
DB_USER=postgres | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |