feat: Nginx configurated to server images for catalog in production.
This commit is contained in:
@@ -44,7 +44,7 @@ services:
|
||||
- media_volume:/app/media
|
||||
- logs_volume:/app/logs
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "127.0.0.1:9000:8000"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
@@ -57,22 +57,20 @@ services:
|
||||
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 4 --timeout 120"
|
||||
|
||||
# Optional: Nginx reverse proxy para servir archivos estáticos
|
||||
# nginx:
|
||||
# image: nginx:alpine
|
||||
# container_name: tienda_ilusion_nginx
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# volumes:
|
||||
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
# - static_volume:/var/www/static:ro
|
||||
# - media_volume:/var/www/media:ro
|
||||
# - ./ssl:/etc/nginx/ssl:ro
|
||||
# depends_on:
|
||||
# - django
|
||||
# networks:
|
||||
# - tienda_network
|
||||
# restart: unless-stopped
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "10297:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- static_volume:/var/www/static
|
||||
- media_volume:/var/www/media
|
||||
- ./dist:/var/www/donconfiao
|
||||
depends_on:
|
||||
- django
|
||||
networks:
|
||||
- tienda_network
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
36
nginx.conf
Normal file
36
nginx.conf
Normal file
@@ -0,0 +1,36 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
client_max_body_size 10M;
|
||||
|
||||
location /media/ {
|
||||
alias /var/www/media/;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /var/www/static/;
|
||||
expires 365d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location / {
|
||||
root /var/www/donconfiao/;
|
||||
try_files $uri /index.html;
|
||||
expires -1;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user