mirror of
https://github.com/veops/oneterm.git
synced 2025-09-26 19:31:14 +08:00
113 lines
4.2 KiB
Plaintext
113 lines
4.2 KiB
Plaintext
server {
|
|
listen ${NGINX_PORT};
|
|
access_log /var/log/nginx/access.oneterm.log;
|
|
error_log /var/log/nginx/error.oneterm.log;
|
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
add_header 'Access-Control-Allow-Credentials' 'true';
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With';
|
|
|
|
gzip on;
|
|
gzip_comp_level 6;
|
|
gzip_buffers 16 8k;
|
|
gzip_http_version 1.1;
|
|
gzip_min_length 256;
|
|
gzip_types
|
|
text/plain
|
|
text/css
|
|
text/js
|
|
text/xml
|
|
text/javascript
|
|
application/javascript
|
|
application/x-javascript
|
|
application/json
|
|
application/xml
|
|
application/rss+xml
|
|
image/svg+xml;
|
|
|
|
root /etc/nginx/html;
|
|
location / {
|
|
root /etc/nginx/html;
|
|
index index.html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location ^~ /api/oneterm/v1/connect {
|
|
proxy_pass http://${ONETERM_API_HOST};
|
|
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-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_redirect off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_read_timeout 7200s;
|
|
proxy_connect_timeout 7200s;
|
|
proxy_send_timeout 7200s;
|
|
}
|
|
|
|
# File upload configuration for all upload endpoints
|
|
# Matches: /api/oneterm/v1/rdp/sessions/:session_id/files/upload
|
|
# /api/oneterm/v1/file/session/:session_id/upload
|
|
# /api/oneterm/v1/file/upload/:asset_id/:account_id
|
|
location ~ ^/api/oneterm/v1/(rdp/sessions/.+/files/upload|file/(session/.+/upload|upload/.+/.+)) {
|
|
proxy_pass http://${ONETERM_API_HOST};
|
|
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-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_redirect off;
|
|
proxy_http_version 1.1;
|
|
|
|
# File upload optimization
|
|
proxy_request_buffering off; # Disable request buffering for streaming upload
|
|
proxy_buffering off; # Disable response buffering
|
|
proxy_read_timeout 1800s; # Read timeout: 30 minutes
|
|
proxy_send_timeout 1800s; # Send timeout: 30 minutes
|
|
proxy_connect_timeout 60s; # Connect timeout: 1 minute
|
|
|
|
# Large file upload settings
|
|
client_max_body_size 10240m; # Max file size: 10GB
|
|
client_body_buffer_size 32m; # Buffer size: 32MB
|
|
client_body_timeout 1800s; # Body timeout: 30 minutes
|
|
}
|
|
|
|
location ^~ /api/oneterm {
|
|
proxy_pass http://${ONETERM_API_HOST};
|
|
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-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_redirect off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
|
|
|
|
location /api {
|
|
proxy_pass http://${ACL_API_HOST};
|
|
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-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_redirect off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
location ~* \.(css|js)$ {
|
|
access_log off;
|
|
add_header Pragma public;
|
|
add_header Cache-Control "public, max-age=7776000";
|
|
#add_header Cache-Control "public,no-cache, max-age=0";
|
|
add_header X-Asset "yes";
|
|
}
|
|
}
|