diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index d6a38fb..650a424 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -1,24 +1,50 @@ -user www-data; +user nginx; worker_processes auto; -pid /run/nginx.pid; -include /etc/nginx/modules-enabled/*.conf; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; events { - worker_connections 768; + worker_connections 1024; } http { - sendfile on; - tcp_nopush on; - types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; - gzip on; + access_log /var/log/nginx/access.log main; + + sendfile on; + keepalive_timeout 65; - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + # Frontend routes + location / { + try_files $uri $uri/ /index.html; + expires -1; + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + # Backend API proxy + location /api/ { + proxy_pass http://backend:8000/api/; + proxy_http_version 1.1; + 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; + proxy_connect_timeout 60s; + proxy_send_timeout 60s; + proxy_read_timeout 60s; + } + } } \ No newline at end of file