vue的X-Templates

当组件模板内容冗长复杂时,在JavaScript里拼接字符串效率低。Vue提供在< script >标签里使用text/x-template类型并指定id,将id赋给template的方式定义模板,可在< script >标签里愉快写html代码,无需考虑换行等问题。

当你写的组件模板template内容很冗长和复杂时,如果都在JavaScript里拼接字符串,效率是很低的,因为不像直接写html简单。
为了解决这个问题,Vue提供了另一种定义模板的方式,在< script >标签里使用text/x-template类型,并且指定一个id,将这个id赋给template。代码如下

<div id="app">
	<my-component></my-component>
	<script type="text/x-template" id="my-component">
		<div>这是组件的内容</div>
	</script>
</div>
<script>
	Vue.component('my-component',{
		template:'#my-component'
	}),
	vat app = new Vue({
		el:"#app"
	})
</script>

运行效果如下图:
在这里插入图片描述
在< script >标签里,就可以愉快地写html代码而不用考虑换行等问题了

zy@zy-VMware-Virtual-Platform:~/zy/project-zy$ docker-compose logs -f vue-app vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:25:42 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:25:51 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:25:59 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:26:08 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:26:17 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:26:26 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:26:38 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:26:52 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:27:13 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:27:47 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:28:46 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:29:54 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:31:03 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:32:11 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:33:19 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:34:27 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:35:35 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration vue-app | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh vue-app | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist vue-app | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh vue-app | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh vue-app | /docker-entrypoint.sh: Configuration complete; ready for start up vue-app | 2025/08/08 18:36:43 [emerg] 1#1: host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 vue-app | nginx: [emerg] host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13
08-10
你遇到的错误是: ``` host not found in upstream "java-app" in /etc/nginx/conf.d/vue.conf:13 ``` 这说明你的 **Nginx 容器无法解析名为 `java-app` 的上游服务**,也就是说 Nginx 找不到名为 `java-app` 的容器或服务。 --- ## 🛠️ 错误原因分析 这个错误通常出现在使用 Nginx 作为反向代理时,配置中使用了类似: ```nginx upstream java-app { server java-app:8080; } ``` 但容器启动时,Nginx 在解析 `java-app` 这个主机名时失败,原因可能包括: 1. **服务名称拼写错误** 2. **Docker Compose 网络配置不正确** 3. **Nginx 启动时后端服务尚未就绪** 4. **未在同一个 Docker Compose 网络中** --- ## ✅ 解决方案 ### ✅ 1. 确保服务名在 `docker-compose.yml` 中定义正确 ```yaml services: java-app: image: java-app container_name: java-app ports: - "8080:8080" networks: - app-network vue-app: image: vue-app container_name: vue-app ports: - "80:80" networks: - app-network depends_on: - java-app networks: app-network: driver: bridge ``` - `container_name` 必须是 `java-app` - `networks` 需要一致(如 `app-network`) --- ### ✅ 2. 确保 Nginx 配置中使用的是服务名而不是 IP 地址 ```nginx upstream java-app { server java-app:8080; } ``` 不要写成: ```nginx upstream java-app { server 127.0.0.1:8080; # ❌ 不可行 } ``` --- ### ✅ 3. 确保 `depends_on` 正确设置 ```yaml depends_on: - java-app ``` 这能确保 `vue-app` 容器在 `java-app` 容器启动后再启动。 但注意:`depends_on` 只保证容器启动顺序,**不保证应用就绪**。你可以使用健康检查或脚本等待后端服务可用。 --- ### ✅ 4. 使用脚本等待 Java 服务就绪(可选) 可以在 `vue-app` 启动前添加一个脚本等待 Java 服务可用: ```bash #!/bin/sh set -e # 等待 java-app 服务可用 while ! nc -z java-app 8080; do echo "等待 java-app 启动..." sleep 1 done echo "java-app 已就绪,启动 Nginx" nginx -g &#39;daemon off;&#39; ``` 然后在 Dockerfile 中替换默认的启动命令: ```Dockerfile COPY wait-for-java.sh /wait-for-java.sh RUN chmod +x /wait-for-java.sh CMD ["/wait-for-java.sh"] ``` --- ### ✅ 5. 确保 Nginx 使用 Docker Compose 网络解析服务名 - 所有服务必须在同一个 `networks` 下 - 不要使用 `links`,除非你使用旧版 Compose - 不要使用 `localhost`,因为每个容器有自己的网络命名空间 --- ### ✅ 示例 Nginx 配置文件 `vue.conf` ```nginx server { listen 80; location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ =404; } location /api/ { proxy_pass http://java-app:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` --- ## ✅ 总结 | 问题 | 原因 | 解决方案 | |------|------|----------| | host not found in upstream | Nginx 无法解析 `java-app` | 确保服务名正确、网络一致、使用 DNS 解析 | | 服务启动顺序问题 | Java 服务未就绪 | 使用 `depends_on` 或等待脚本 | | 使用 `localhost` | 容器内部无法访问其他容器 | 改用服务名访问 | | Nginx 启动失败 | 配置错误 | 检查 `/etc/nginx/conf.d/vue.conf` | --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值