feat: Nginx configurated to server images for catalog in production.
This commit is contained in:
@@ -44,7 +44,7 @@ services:
|
|||||||
- media_volume:/app/media
|
- media_volume:/app/media
|
||||||
- logs_volume:/app/logs
|
- logs_volume:/app/logs
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "127.0.0.1:9000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -57,22 +57,20 @@ services:
|
|||||||
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 4 --timeout 120"
|
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 4 --timeout 120"
|
||||||
|
|
||||||
# Optional: Nginx reverse proxy para servir archivos estáticos
|
# Optional: Nginx reverse proxy para servir archivos estáticos
|
||||||
# nginx:
|
nginx:
|
||||||
# image: nginx:alpine
|
image: nginx:alpine
|
||||||
# container_name: tienda_ilusion_nginx
|
ports:
|
||||||
# ports:
|
- "10297:80"
|
||||||
# - "80:80"
|
volumes:
|
||||||
# - "443:443"
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
# volumes:
|
- static_volume:/var/www/static
|
||||||
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
|
- media_volume:/var/www/media
|
||||||
# - static_volume:/var/www/static:ro
|
- ./dist:/var/www/donconfiao
|
||||||
# - media_volume:/var/www/media:ro
|
depends_on:
|
||||||
# - ./ssl:/etc/nginx/ssl:ro
|
- django
|
||||||
# depends_on:
|
networks:
|
||||||
# - django
|
- tienda_network
|
||||||
# networks:
|
restart: unless-stopped
|
||||||
# - tienda_network
|
|
||||||
# restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
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