Nginx与docker不工作的Web应用程序
我正在尝试在docker中为我的react / flux webapp设置一个容器。 我决定去与一个nginx服务器来处理聆听和路由。
这是nginx的web.confconfiguration文件
server { listen 80; location / { root /www/web_files; try_files $uri $uri/ /index.html =404; index index.html; add_header expires off; } }
现在,我在docker的一个amazon节点上部署了这个节点,并且可以在VM的公共IP上访问它。
http://54.238.176.11
现在,我想设置我的/ www / web_files目录,其中nginx将search$ uri或index.html
这是我的我的容器for web_files泊坞窗文件。 我将它部署在与我的nginx服务器相同的节点上。
FROM ubuntu RUN apt-get update RUN apt-get -y install bash git openssh-client g++ gcc libc6-dev make curl RUN curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash - RUN apt-get -y install nodejs python RUN npm install -g npm@2.7.6 WORKDIR /app ADD . /app RUN npm install RUN npm run build RUN rm -rf node_modules CMD rm -rf /www/web_files && cp -R ./build /www/web_files
所以这应该复制我的./build文件夹(生成由npm运行build_到/ www / web_files。
为什么现在,当我访问上面的IP地址,我仍然得到nginx页面。 我会假设它会打开index.html或$ uri页面。 我在这里错过了什么?