fix: ensure SSR always fetches fresh assets from database #9
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
|
||||||
|
|||||||
+27
-15
@@ -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;
|
||||||
'"time":"$time_iso8601",'
|
default_type application/octet-stream;
|
||||||
'"remote_addr":"$remote_addr",'
|
|
||||||
'"x_forwarded_for":"$http_x_forwarded_for"'
|
|
||||||
'}';
|
|
||||||
|
|
||||||
access_log /logs/access-$log_date.log kmtn_json;
|
log_format kmtn_json escape=json
|
||||||
|
'{'
|
||||||
|
'"time":"$time_iso8601",'
|
||||||
|
'"remote_addr":"$remote_addr",'
|
||||||
|
'"x_forwarded_for":"$http_x_forwarded_for"'
|
||||||
|
'}';
|
||||||
|
|
||||||
upstream ssr_backend {
|
access_log /logs/access.log kmtn_json;
|
||||||
server 127.0.0.1:4200;
|
sendfile on;
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
upstream ssr_backend {
|
||||||
|
server 127.0.0.1:4200;
|
||||||
|
}
|
||||||
|
|
||||||
|
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