Spring boot 我们应该如何为spring boot docker应用程序进行nginx反向代理配置?
我有两个spring启动应用程序和nginx web服务器。这些应用程序与docker compose一起工作。我想分别在9000、9001、9002端口上运行我的应用程序。(nginx->9000,spring-boot-app1->9001,spring-boot-app2->9002) spring-app1应可从处的浏览器访问,spring-app2应可从处的浏览器访问 据此,如何配置nginx 项目文件夹结构Spring boot 我们应该如何为spring boot docker应用程序进行nginx反向代理配置?,spring-boot,docker,nginx,docker-compose,nginx-reverse-proxy,Spring Boot,Docker,Nginx,Docker Compose,Nginx Reverse Proxy,我有两个spring启动应用程序和nginx web服务器。这些应用程序与docker compose一起工作。我想分别在9000、9001、9002端口上运行我的应用程序。(nginx->9000,spring-boot-app1->9001,spring-boot-app2->9002) spring-app1应可从处的浏览器访问,spring-app2应可从处的浏览器访问 据此,如何配置nginx 项目文件夹结构 |── ... │ │── nginx
|── ...
│
│── nginx
│ ├── default.conf
│ ├── Dockerfile
│
├── web-static
│ ├── src
│ ├── pom.xml
│ ├── Dockerfile
│
├── web-ui
│ ├── src
│ ├── pom.xml
│ ├── Dockerfile
│
├── docker-compose.yml
server {
listen 80;
location / {
proxy_pass http://service1:9000;
}
location /ui {
proxy_pass http://service2:9000/;
}
}
docker compose.yml
version: '3'
services:
proxy:
container_name: proxy
build: ./nginx
image: proxy
ports:
- "9000:80"
service1:
container_name: service1
build: ./web-static
image: service1
ports:
- "9001:9000"
service2:
container_name: service2
build: ./web-ui
image: service2
ports:
- "9002:9000"
nginx.conf文件
|── ...
│
│── nginx
│ ├── default.conf
│ ├── Dockerfile
│
├── web-static
│ ├── src
│ ├── pom.xml
│ ├── Dockerfile
│
├── web-ui
│ ├── src
│ ├── pom.xml
│ ├── Dockerfile
│
├── docker-compose.yml
server {
listen 80;
location / {
proxy_pass http://service1:9000;
}
location /ui {
proxy_pass http://service2:9000/;
}
}
我对Nginx配置文件做了一些更改。但是,css、图像文件和请求无法正常工作,也无法显示。
请求示例:我的请求“localhost:9000/ui/?form”。但是localhost:9000正在响应请求。我不要这个