需要一些帮助。我有这个 nginx configserver { listen 80; server_name localhot; root /opt/apps; index index.php index.html index.htm index.nginx-debian.html;
需要一些帮助。我有这个 nginx 配置
server {
listen 80;
server_name localhot;
root /opt/apps;
index index.php index.html index.htm index.nginx-debian.html;
client_max_body_size 512M;
server_tokens off;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
error_page 404 /404.html;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 300s;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
location /test.js {
rewrite ^/test\.(.*)\.js$ /test.$1.js last;
}
location /api/ {
rewrite ^/api/(.*)$ /api.php/$1 last;
}
}
我有文件 localhost/test.2.1.9.js,它可以访问,但是当我尝试访问 localhost/test.js 时它返回 404。