Files
Lydc_backend/nginx/conf/nginx.conf

73 lines
2.2 KiB
Nginx Configuration File
Raw Permalink Normal View History

2025-11-25 17:51:39 +08:00
worker_processes auto; ## Default: 1
worker_rlimit_nofile 8192;
events {
worker_connections 1024; ## Default: 1024
}
http {
sendfile on;
tcp_nopush on;
log_not_found off;
gzip on;
include mime.types; # web pages might not be rendered properly if mime.types not included
default_type application/octet-stream;
client_max_body_size 500M;
keepalive_timeout 30s;
upstream backend {
server localhost:9001;
}
# the Connection header will be correctly set to close when the Upgrade header in the request is set to ''.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 9000;
# This is the default block since / matches all requests.
# It should be used to serve static files.
location / {
# Search ./resources/xxx first;
# if not found, search ./resources/index.html instead;
# if still not found, respond 404.
root ./resources;
try_files $uri /index.html =404;
}
# Both the trailing slashes in location and proxy_pass matter
# because if the proxy_pass directive is specified with a URI,
# then when a request is passed to the server,
# the part of a normalized request URI matching the location is replaced by a URI specified in the directive
location /api/ {
# /api/** will be forwarded to http://backend/**
proxy_pass http://backend/;
# For NGINX to send the Upgrade request from the client to the backend server,
# the Upgrade and Connection headers must be set explicitly
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location = /allocation/assignment { # This is an exact match.
# /allocation/assignment will be forwarded to http://backend/allocation/assignment
proxy_pass http://backend;
}
location /get/ {
# /get/** will be forwarded to http://backend/get/**
proxy_pass http://backend;
}
location = /export/taskTableDataExport {
proxy_pass http://backend;
}
location = /task/createTaskByXmlFile {
proxy_pass http://backend;
}
}
}