2024-10-25 22:57:10 -04:00
|
|
|
worker_processes 1;
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
http {
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 65;
|
2024-12-01 09:52:34 -05:00
|
|
|
client_max_body_size 100M;
|
2025-05-31 21:54:45 -04:00
|
|
|
|
2024-10-25 22:57:10 -04:00
|
|
|
upstream django {
|
2025-05-31 21:36:23 -04:00
|
|
|
server 127.0.0.1:8000;
|
2024-10-25 22:57:10 -04:00
|
|
|
}
|
2025-05-31 21:54:45 -04:00
|
|
|
|
2024-10-25 22:57:10 -04:00
|
|
|
server {
|
2025-01-18 17:03:03 -05:00
|
|
|
listen 80;
|
2024-10-25 22:57:10 -04:00
|
|
|
server_name localhost;
|
2025-05-31 21:54:45 -04:00
|
|
|
|
2024-10-25 22:57:10 -04:00
|
|
|
location / {
|
2025-05-31 21:36:23 -04:00
|
|
|
proxy_pass http://django;
|
2024-10-25 22:57:10 -04:00
|
|
|
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;
|
|
|
|
}
|
2025-05-31 21:54:45 -04:00
|
|
|
|
2024-10-25 22:57:10 -04:00
|
|
|
location /static/ {
|
2025-05-31 21:36:23 -04:00
|
|
|
alias /code/staticfiles/;
|
2024-10-25 22:57:10 -04:00
|
|
|
}
|
2025-05-31 21:54:45 -04:00
|
|
|
|
|
|
|
# Special handling for PDF files with CSP headers
|
2025-06-01 12:47:08 -04:00
|
|
|
location ~ ^/protectedMedia/(.*)\.pdf$ {
|
2025-05-31 21:08:20 -04:00
|
|
|
internal;
|
2025-06-01 12:47:08 -04:00
|
|
|
alias /code/media/$1.pdf;
|
2025-05-29 18:02:05 -04:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'none'; object-src 'none'; base-uri 'none'" always;
|
|
|
|
add_header X-Content-Type-Options nosniff always;
|
|
|
|
add_header X-Frame-Options SAMEORIGIN always;
|
|
|
|
add_header Content-Disposition "inline" always;
|
|
|
|
}
|
2025-05-31 21:54:45 -04:00
|
|
|
|
|
|
|
# General protected media files (non-PDF)
|
2025-06-01 12:47:08 -04:00
|
|
|
location ~ ^/protectedMedia/(.*)$ {
|
2025-05-31 21:54:45 -04:00
|
|
|
internal;
|
2025-06-01 12:47:08 -04:00
|
|
|
alias /code/media/$1;
|
2025-05-31 21:54:45 -04:00
|
|
|
}
|
2024-10-25 22:57:10 -04:00
|
|
|
}
|
2025-05-31 21:54:45 -04:00
|
|
|
}
|