我无法使用基本url访问dockerizedangular应用程序
我是docker工人。 我用这种方式整合了我的基础设 我在nginx镜像里敲了我的angular 4项目。 我也使用nginx作为angular度项目和api之间的反向代理。 我想访问我的应用程序使用URL http://localhost:9000/system
但我只能做http://localhost:9000
。 运行这个之后
docker run -p 9000:80 -dit nginx
我试图构build我的angular度应用程序ng build --prod --base-href /system
,并更改<base href='/system'/>
。 它的工作在我的开发机器罚款,但是当我说唱内docker我只能访问http://localhost:9000
,更糟糕的是,我刷新浏览器后无法访问应用程序。
Dockerfile
# Set the base image to nginx FROM nginx COPY nginx /usr/share/nginx/html # Expose ports EXPOSE 80
nginx.conf
worker_processes 1; events { worker_connections 1024; use epoll; } http { include mime.types; default_type application/octet-stream; server { listen 80; server_name _; root pos; index index.html index.htm; location /api/service { # Preflighted requests if ($request_method = OPTIONS ) { add_header "Access-Control-Allow-Origin" *; add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD, PUT, DELETE"; add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Allow-Origin"; add_header "Access-Control-Max-Age" 1728000; #add_header "Access-Control-Allow-Credentials" true; add_header "Content-Type" "text/plain; charset=utf-8"; add_header "Content-Length" 0; return 204; } proxy_pass http://127.0.0.1:3000; }
- 在Docker中运行busybox httpd的angular2 webpack应用程序
- Neo4j – 如何使用Docker镜像从安全连接访问螺栓?
- 量angular器testing在Jenkins的Docker中随机超时,在本地Docker中正常工作
- 在Docker中使用自动构build不能使用Bootstrap样式?
- 尽pipe前端使用docker-up up和ng serve正确地编译,只有ng服务才能正常工作
- 在Docker中创build一个ng-cli容器不工作
- Docker-Selenium铬容器的最大数量
- 将docker-comp的envvariables注入到Angular4应用程序中
- Angular2在Docker中找不到module:'./class'