运维脚本调整

This commit is contained in:
2026-06-26 15:58:00 +08:00
parent 0f01b301e9
commit 5de47b5701
2 changed files with 18 additions and 6 deletions
+12
View File
@@ -24,6 +24,18 @@ COPY ngnix.conf /etc/nginx/conf.d/default.conf
# 复制SSL证书
COPY ssl/* /etc/nginx/ssl/
# 启动时自动获取宿主机内网 IP,替换 __API_HOST__ 占位符
RUN printf '%s\n' \
'#!/bin/sh' \
'set -e' \
'if [ -n "$API_HOST" ]; then' \
' HOST_IP="$API_HOST"' \
'else' \
' HOST_IP=$(route -n 2>/dev/null | grep "^0.0.0.0" | tr -s " " | cut -d " " -f2)' \
'fi' \
'sed -i "s/__API_HOST__/$HOST_IP/g" /etc/nginx/conf.d/default.conf' \
> /docker-entrypoint.d/01-set-api-host.sh && chmod +x /docker-entrypoint.d/01-set-api-host.sh
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
+6 -6
View File
@@ -19,7 +19,7 @@ server {
listen 80;
server_name minio.redpowerfuture.com;
location / {
proxy_pass http://192.168.0.83:9000;
proxy_pass http://__API_HOST__:9001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -33,7 +33,7 @@ server {
listen 80;
server_name consul.redpowerfuture.com;
location / {
proxy_pass http://192.168.0.83:8500;
proxy_pass http://__API_HOST__:8500;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -47,7 +47,7 @@ server {
listen 80;
server_name meilisearch.redpowerfuture.com;
location / {
proxy_pass http://192.168.0.83:7700;
proxy_pass http://__API_HOST__:7700;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -73,7 +73,7 @@ server {
listen 80;
server_name jaeger.redpowerfuture.com;
location / {
proxy_pass http://192.168.0.83:16686;
proxy_pass http://__API_HOST__:16686;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -132,7 +132,7 @@ server {
return 404;
}
proxy_pass http://192.168.0.83:8000;
proxy_pass http://__API_HOST__:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -178,7 +178,7 @@ server {
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://192.168.0.83:9000;
proxy_pass http://__API_HOST__:9001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;