fix: use full nginx.conf instead of conf.d snippet to avoid directive nesting error
CI Pipeline / backend-test (push) Successful in 5m1s
CI Pipeline / frontend-test (push) Successful in 29s
CI Pipeline / frontend-build (push) Successful in 30s
CI Pipeline / backend-lint (push) Successful in 10s
CI Pipeline / backend-test (pull_request) Successful in 4m48s
CI Pipeline / frontend-test (pull_request) Successful in 24s
CI Pipeline / frontend-build (pull_request) Successful in 30s
CI Pipeline / backend-lint (pull_request) Successful in 10s
CI Pipeline / quality-gate (push) Successful in 2s
CI Pipeline / quality-gate (pull_request) Successful in 2s
CI Pipeline / backend-test (push) Successful in 5m1s
CI Pipeline / frontend-test (push) Successful in 29s
CI Pipeline / frontend-build (push) Successful in 30s
CI Pipeline / backend-lint (push) Successful in 10s
CI Pipeline / backend-test (pull_request) Successful in 4m48s
CI Pipeline / frontend-test (pull_request) Successful in 24s
CI Pipeline / frontend-build (pull_request) Successful in 30s
CI Pipeline / backend-lint (pull_request) Successful in 10s
CI Pipeline / quality-gate (push) Successful in 2s
CI Pipeline / quality-gate (pull_request) Successful in 2s
Alpine nginx includes conf.d/*.conf inside the http{} block, but our
template contained map/log_format directives and a server{} block that
conflicted with the include structure. Switched to a complete standalone
nginx.conf with proper user/events/http nesting.
This commit is contained in:
1 parent
8f0adf9299
commit
89cac854ae
2 files changed
+24
-11
No files matched your search
@@ -5,8 +5,9 @@ set -e
|
|||||||
# Ensure nginx can write to the shared logs directory
|
# Ensure nginx can write to the shared logs directory
|
||||||
mkdir -p /logs && chown nginx:nginx /logs
|
mkdir -p /logs && chown nginx:nginx /logs
|
||||||
|
|
||||||
# Render nginx config from template
|
# Render nginx config from template to /etc/nginx/nginx.conf
|
||||||
sed "s|__API_UPSTREAM__|${API_UPSTREAM}|g" /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf
|
# (full config, not conf.d/ snippet — avoids Alpine include nesting issues)
|
||||||
|
sed "s|__API_UPSTREAM__|${API_UPSTREAM}|g" /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Render client-side config.json for fallback use
|
# Render client-side config.json for fallback use
|
||||||
envsubst '${API_PUBLIC_URL}' < /usr/share/nginx/html/config.json.template > /usr/share/nginx/html/config.json
|
envsubst '${API_PUBLIC_URL}' < /usr/share/nginx/html/config.json.template > /usr/share/nginx/html/config.json
|
||||||
|
|||||||
+21
-9
@@ -1,23 +1,34 @@
|
|||||||
# Map ISO timestamp to date-only string for daily log rotation
|
# Full nginx configuration — rendered to /etc/nginx/nginx.conf
|
||||||
map $time_iso8601 $log_date {
|
# (NOT placed in conf.d/ to avoid include nesting issues with Alpine nginx)
|
||||||
"~^(?<date>\d{4}-\d{2}-\d{2})" $date;
|
|
||||||
default "unknown";
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_format kmtn_json escape=json
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format kmtn_json escape=json
|
||||||
'{'
|
'{'
|
||||||
'"time":"$time_iso8601",'
|
'"time":"$time_iso8601",'
|
||||||
'"remote_addr":"$remote_addr",'
|
'"remote_addr":"$remote_addr",'
|
||||||
'"x_forwarded_for":"$http_x_forwarded_for"'
|
'"x_forwarded_for":"$http_x_forwarded_for"'
|
||||||
'}';
|
'}';
|
||||||
|
|
||||||
access_log /logs/access-$log_date.log kmtn_json;
|
access_log /logs/access.log kmtn_json;
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
upstream ssr_backend {
|
upstream ssr_backend {
|
||||||
server 127.0.0.1:4200;
|
server 127.0.0.1:4200;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
@@ -83,3 +94,4 @@ server {
|
|||||||
add_header X-Powered-By "Angular SSR" always;
|
add_header X-Powered-By "Angular SSR" always;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user