Location configuration is invalid when nginx is accessed by domain name

here is the configuration section. Location is configured to access the static file in the / test/files/ directory when / file/ matches. The test uses ip access to download files normally, but it does not seem to take effect when using the domain name. The request is reversed and proxied to tomcat for processing, and then 404.

is returned.
server
  {
    listen     80;
    server_name host.com;
    root  /var/www/html;
    proxy_ignore_client_abort on;

    -sharplimit_conn   crawler  20;

    location ^~ /file/ {
        alias  /test/files/;
    }

    location / {
           proxy_set_header X-real-ip $remote_addr;
           proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header  Host $http_host;
           proxy_pass http://tomcat_svr;
    }
}
Mar.30,2021

try
location / file {

}
or
location ^ / file/ {
alias / test/files;
}
try both. I don't know which directory your files are in

.

has been solved, and the reason for abnormal operation and maintenance will not be posted.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46ace-44117.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46ace-44117.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?