nginx 没有为代理通行证加载 .css 和 .js 文件

问题描述 投票:0回答:0

我是 nginx 的初学者,我正在尝试托管静态反应构建页面。 当我点击 http://servername:8081/ 时,应用程序完美加载 (我的应用程序运行在'/')

问题出现在 我想将这个(http://servername:8081/)映射到 url(http://www.something.com/IQ16MS

所以当我点击 [http://www.something.com/IQ16MS] 它应该加载 [http://servername:8081/] 但它无法加载 .css、.js 和 manifest.js 文件并给出空白页

请帮忙!

这里是 nginx.config 文件和 Docker 文件的详细信息

------------------------nginx.config-------------------- --------------

server
{

listen 80;

root /usr/share/nginx/html/build;
index index.html index.htm;

location / { try_files $uri $uri/ /index.html; }

location /IQ16MS
{
client_max_body_size 20m;

`proxy_pass http://servername:8081/build;`

}

}

----------------------------结束---------------- ----------------------

----------------------------DockerFile------------------ ----------

FROM nginx

WORKDIR /usr/share/nginx/html/build

RUN rm -rf ./*

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY build/ .

EXPOSE 80 ENTRYPOINT ["nginx","-g","daemon off;"]

----------------------------结束---------------- ----------------------

----------------------------Docker命令------------------ ------

sudo docker build -t reactapp .

sudo docker run --name reactContainer -d -p 8081:80 reactapp

reactjs nginx nginx-config
© www.soinside.com 2019 - 2024. All rights reserved.