93 lines
3.0 KiB
Nginx Configuration File
93 lines
3.0 KiB
Nginx Configuration File
server {
|
|
listen 3000 default_server;
|
|
listen [::]:3000 default_server;
|
|
|
|
root /app/code;
|
|
index index.html;
|
|
|
|
client_max_body_size 100m;
|
|
|
|
# Create temporary directories in writable locations
|
|
client_body_temp_path /tmp/nginx_client_temp;
|
|
proxy_temp_path /tmp/nginx_proxy_temp;
|
|
fastcgi_temp_path /tmp/nginx_fastcgi_temp;
|
|
uwsgi_temp_path /tmp/nginx_uwsgi_temp;
|
|
scgi_temp_path /tmp/nginx_scgi_temp;
|
|
|
|
# Log to stdout/stderr instead of files
|
|
access_log /dev/stdout;
|
|
error_log /dev/stderr;
|
|
|
|
# Enable compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_proxied expired no-cache no-store private auth;
|
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss;
|
|
|
|
# Proxy to Docmost application
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
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_cache_bypass $http_upgrade;
|
|
proxy_read_timeout 86400;
|
|
}
|
|
|
|
# WebSocket support for real-time collaboration
|
|
location /socket.io/ {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
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_read_timeout 86400;
|
|
}
|
|
|
|
# OIDC callback endpoint
|
|
location /api/v1/session/callback {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
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;
|
|
}
|
|
|
|
# API endpoints
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
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_read_timeout 300;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /api/health {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
proxy_set_header Host $host;
|
|
access_log off;
|
|
}
|
|
|
|
# Static files (if served by nginx)
|
|
location /uploads/ {
|
|
alias /app/data/uploads/;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
} |