Skip to content

Commit

Permalink
add nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
RyjkovAlexey committed Mar 18, 2024
1 parent b36aaaf commit b147ecd
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 24 deletions.
24 changes: 0 additions & 24 deletions backend/docker-compose.yml

This file was deleted.

32 changes: 32 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
worker_processes 1;

events { worker_connections 1024; }

http {
sendfile on;

upstream backend {
server backend:8080;
}

server {
listen 80;
server_name blog.zeroxzed.ru;
access_log /var/log/nginx/blog.zeroxzed.ru-access.log;
error_log /var/log/nginx/blog.zeroxzed.ru-error.log;

location = / {
proxy_pass http://backend/animals/index;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}

location / {
proxy_pass http://backend/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
60 changes: 60 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: "3.3"
services:
shelter_db:
image: postgres:15.5
volumes:
- './docker/database:/var/lib/postgresql/data'
env_file:
- ./backend/.env
networks:
- web

backend:
container_name: backend
command: python3 /backend/main.py
depends_on:
- shelter_db
build:
context: ../
dockerfile: ./backend/Dockerfile
ports:
- "8080:8080"
volumes:
- ./:/app
- ../animal_photos:/animal_photos
env_file:
- ./backend/.env
networks:
- web

nginx:
image: nginx
hostname: nginx-entrypoint
restart: unless-stopped
container_name: nginx-entrypoint
depends_on:
- shelter_db
- backend
environment:
TZ: "Europe/Moscow"
ports:
- "80:80"
- "443:443"
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./conf/conf.d:/etc/nginx/conf.d
- ./conf/ssl:/etc/nginx/ssl
- ./well-known:/usr/share/nginx/html
- ./certs:/etc/letsencrypt
- ../animal_photos:/download/photo/
networks:
- web

networks:
web:
driver: bridge
attachable: true
ipam:
driver: default
config:
- subnet: 162.28.0.0/16

0 comments on commit b147ecd

Please sign in to comment.