101 lines
2.6 KiB
Plaintext
101 lines
2.6 KiB
Plaintext
# Nginx config for Seafile single-container
|
|
# Rendered by entrypoint.sh -> /etc/nginx/nginx.conf
|
|
|
|
user www-data;
|
|
worker_processes auto;
|
|
pid /run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
server_tokens off;
|
|
|
|
client_max_body_size {{NGINX_MAX_BODY}};
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
access_log {{LOG_DIR}}/nginx/access.log main;
|
|
error_log {{LOG_DIR}}/nginx/error.log warn;
|
|
|
|
upstream seahub {
|
|
server 127.0.0.1:8000;
|
|
keepalive 32;
|
|
}
|
|
|
|
upstream fileserver {
|
|
server 127.0.0.1:8082;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
server_name {{SERVER_NAME}};
|
|
|
|
# If you terminate TLS here, add:
|
|
# listen 443 ssl http2;
|
|
# ssl_certificate /data/ssl/fullchain.pem;
|
|
# ssl_certificate_key /data/ssl/privkey.pem;
|
|
|
|
# Seahub (Django) app
|
|
location / {
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_read_timeout 1200;
|
|
proxy_connect_timeout 90;
|
|
proxy_pass http://seahub;
|
|
}
|
|
|
|
# Seafile Go fileserver
|
|
location /seafhttp {
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
# Large uploads
|
|
client_max_body_size {{NGINX_MAX_BODY}};
|
|
proxy_request_buffering off;
|
|
proxy_buffering off;
|
|
|
|
proxy_read_timeout 1200;
|
|
proxy_connect_timeout 90;
|
|
|
|
proxy_pass http://fileserver;
|
|
}
|
|
|
|
# Seahub media (user uploads, avatars) stored on /data
|
|
location /media {
|
|
alias {{SEAHUB_MEDIA_DIR}};
|
|
access_log off;
|
|
expires 7d;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
# Optional: serve collected static if needed (usually handled by Django collectstatic)
|
|
# location /assets {
|
|
# alias {{SEAF_RELEASE_DIR}}/seahub/static;
|
|
# access_log off;
|
|
# expires 7d;
|
|
# add_header Cache-Control "public";
|
|
# }
|
|
}
|
|
}
|