我有一个react应用程序。当我通过开发服务器(localhost:3000)构建应用程序时,应用程序会正确地使用正确的样式等。
然而,当我通过nginx(通过docker)服务时,我得到了一个完全不同的UI?有人知道为什么吗?
我不认为这是一个docker的问题。我使用webpack,如果这是我可能需要看看?
我的nginx配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /usr/share/nginx/html;
location = / {
try_files $uri /index.html;
}
}
字符串
Dockerfile:
FROM nginx:1.16-alpine
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY public/ /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
型
100d1x
的字符串
1条答案
按热度按时间6gpjuf901#
它加载默认的NGINX配置。你应该添加;
运行rm /etc/nginx/conf.d/default.conf
你的Docker文件
它应该解决你的问题。