一、该问题的重现步骤是什么?
1. 前端yarn build 打包后放在 nginx下
二、你期待的结果是什么?实际看到的又是什么?
能够正常的像 yarn run dev 一样的访问效果
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
windows11 saber3
四、请提供详细的错误堆栈信息,这很重要。
nginx 配置如下
#user nobody;
worker_processes 1;
#error_log /var/log/nginx/error.log warn;
#pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#include /etc/nginx/conf.d/*.conf;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
upstream gateway {
server 10.100.28.16;
}
server {
listen 8000;
server_name web;
root D:/nginx-1.24.0/nginx-1.24.0/html/dist;
location /{
index index.html;
error_page 404 /index.html;
}
location ~ ^/(api/)?actuator {
return 403;
}
location ^~ /oauth/redirect {
rewrite ^(.*)$ /index.html break;
}
location ^~ /api/ {
proxy_redirect off;
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_buffering off;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://gateway/;
}
}
}
五、若有更多详细信息,请在下面提供。
nginx log
127.0.0.1 - - [05/Mar/2025:13:56:00 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:56:00 +0800] "GET /assets/index-C7E3Y2Uh.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:56:00 +0800] "GET /assets/element-plus-SJyyTwgd.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:56:00 +0800] "GET /assets/index-CbhHo1XG.css HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:56:00 +0800] "GET /assets/@smallwei/avue-BgkD_fEv.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:59:59 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:59:59 +0800] "GET /assets/index-C7E3Y2Uh.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:59:59 +0800] "GET /assets/element-plus-SJyyTwgd.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:59:59 +0800] "GET /assets/index-CbhHo1XG.css HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:13:59:59 +0800] "GET /assets/@smallwei/avue-BgkD_fEv.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:00:58 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:14:11 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:14:11 +0800] "GET /assets/index-C7E3Y2Uh.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:14:11 +0800] "GET /assets/element-plus-SJyyTwgd.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:14:11 +0800] "GET /assets/index-CbhHo1XG.css HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:14:11 +0800] "GET /assets/@smallwei/avue-BgkD_fEv.js HTTP/1.1" 304 0 "http://localhost:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [05/Mar/2025:14:14:13 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
扫一扫访问 Blade技术社区 移动端