mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
change docker service environment name
This commit is contained in:
@@ -32,12 +32,12 @@ FULLCHAIN="fullchain.pem"
|
|||||||
PRIVATE_KEY="private.key"
|
PRIVATE_KEY="private.key"
|
||||||
USE_HTTPS="1"
|
USE_HTTPS="1"
|
||||||
|
|
||||||
if [ -z "$DOMAIN" ]; then
|
if [ -z "$NP_DOMAIN" ]; then
|
||||||
echo_error "❌ 错误:必须设置 DOMAIN 环境变量!"
|
echo_error "❌ 错误:必须设置 NP_DOMAIN 环境变量!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo_info "DOMAIN: $DOMAIN"
|
echo_info "NP_DOMAIN: $NP_DOMAIN"
|
||||||
|
|
||||||
# 检查证书是否存在
|
# 检查证书是否存在
|
||||||
if [ -f "$CERT_DIR/$FULLCHAIN" ] && [ -f "$CERT_DIR/$PRIVATE_KEY" ]; then
|
if [ -f "$CERT_DIR/$FULLCHAIN" ] && [ -f "$CERT_DIR/$PRIVATE_KEY" ]; then
|
||||||
@@ -50,12 +50,12 @@ fi
|
|||||||
echo_info "USE_HTTPS: $USE_HTTPS"
|
echo_info "USE_HTTPS: $USE_HTTPS"
|
||||||
|
|
||||||
# 组合子域名变量
|
# 组合子域名变量
|
||||||
export PHPMYADMIN_SERVER_NAME="phpmyadmin.${DOMAIN}"
|
export PHPMYADMIN_SERVER_NAME="phpmyadmin.${NP_DOMAIN}"
|
||||||
|
|
||||||
# 生成配置
|
# 生成配置
|
||||||
APP_CONF="/etc/nginx/conf.d/app.conf"
|
APP_CONF="/etc/nginx/conf.d/app.conf"
|
||||||
PMA_CONF="/etc/nginx/conf.d/phpmyadmin.conf"
|
PMA_CONF="/etc/nginx/conf.d/phpmyadmin.conf"
|
||||||
envsubst '$DOMAIN' < /etc/nginx/conf.d/sites/app.conf.template > "$APP_CONF"
|
envsubst '$NP_DOMAIN' < /etc/nginx/conf.d/sites/app.conf.template > "$APP_CONF"
|
||||||
envsubst '$PHPMYADMIN_SERVER_NAME' < /etc/nginx/conf.d/sites/phpmyadmin.conf.template > "$PMA_CONF"
|
envsubst '$PHPMYADMIN_SERVER_NAME' < /etc/nginx/conf.d/sites/phpmyadmin.conf.template > "$PMA_CONF"
|
||||||
|
|
||||||
# if no certs, remove ssl configuration
|
# if no certs, remove ssl configuration
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen 443 ssl http2;
|
listen 443 ssl http2;
|
||||||
server_name ${DOMAIN};
|
server_name ${NP_DOMAIN};
|
||||||
|
|
||||||
root /var/www/html/public;
|
root /var/www/html/public;
|
||||||
index index.php index.html;
|
index index.php index.html;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Locale
|
|||||||
/** @var Response $response */
|
/** @var Response $response */
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
if ($response instanceof Response || $response instanceof JsonResponse) {
|
if ($response instanceof Response || $response instanceof JsonResponse) {
|
||||||
$response->header('Request-Id', nexus()->getRequestId())->header('Running-In-Octane', RUNNING_IN_OCTANE ? 1 : 0);
|
$response->header('X-Request-Id', nexus()->getRequestId())->header('X-NexusPHP-Version', VERSION_NUMBER);
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ services:
|
|||||||
context: ./.docker/openresty
|
context: ./.docker/openresty
|
||||||
container_name: nexusphp-openresty
|
container_name: nexusphp-openresty
|
||||||
environment:
|
environment:
|
||||||
DOMAIN: ${DOMAIN}
|
DOMAIN: ${NP_DOMAIN}
|
||||||
volumes:
|
volumes:
|
||||||
- ./.docker/openresty/sites:/etc/nginx/conf.d/sites
|
- ./.docker/openresty/sites:/etc/nginx/conf.d/sites
|
||||||
- ./.docker/openresty/certs:/certs
|
- ./.docker/openresty/certs:/certs
|
||||||
|
|||||||
Reference in New Issue
Block a user