feat(nginx-log): 4 个 stack 模板增加 log_format 与 access_log 配置(Docker 开箱即用)

This commit is contained in:
augushong
2026-07-28 00:20:32 +08:00
parent 3405f8de60
commit ce191adfd8
13 changed files with 107 additions and 0 deletions

View File

@@ -209,6 +209,50 @@ $ul_system_menu = array(
"sort" => 0, "sort" => 0,
"status" => 1, "status" => 1,
), ),
array(
"id" => 300,
"pid" => 0,
"title" => "Nginx 日志分析",
"icon" => "fa fa-chart-bar",
"href" => "",
"params" => "",
"target" => "_self",
"sort" => 0,
"status" => 1,
),
array(
"id" => 301,
"pid" => 300,
"title" => "访问统计仪表盘",
"icon" => "fa fa-line-chart",
"href" => "system.nginx_log_stat/index",
"params" => "",
"target" => "_self",
"sort" => 0,
"status" => 1,
),
array(
"id" => 302,
"pid" => 300,
"title" => "原始访问日志",
"icon" => "fa fa-file-text",
"href" => "system.nginx_access_log/index",
"params" => "",
"target" => "_self",
"sort" => 0,
"status" => 1,
),
array(
"id" => 303,
"pid" => 300,
"title" => "读取位置管理",
"icon" => "fa fa-map-marker",
"href" => "system.nginx_log_position/index",
"params" => "",
"target" => "_self",
"sort" => 0,
"status" => 1,
),
); );

View File

@@ -0,0 +1,6 @@
# ulthon_admin nginx_log 分析专用 log_format
# 必须放在 nginx 的 http 块(通过 conf.d/*.conf 自动 include
log_format analytics '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $bytes_sent';

View File

@@ -14,6 +14,9 @@ server {
# 运行时长不限制 # 运行时长不限制
fastcgi_read_timeout 60000; fastcgi_read_timeout 60000;
# ulthon_admin nginx_log 分析access_log 写到 runtime持久化 + PHP 必能读)
access_log /var/www/html/runtime/nginx/access.log analytics;
location / { location / {
if (!-e $request_filename) { if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last; break; rewrite ^(.*)$ /index.php?s=$1 last; break;

View File

@@ -50,6 +50,12 @@ mkdir -p /var/www/html/public/build && chmod -R 777 /var/www/html/public/build
mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage
mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace
# 复制 nginx_log 分析的 log_format 配置到 nginx http 块conf.d 自动 include
cp "$SCRIPT_DIR/nginx-log-format.conf" /etc/nginx/conf.d/
# 创建 nginx access_log 目录(必须在 service nginx start 之前)
mkdir -p /var/www/html/runtime/nginx && chmod 777 /var/www/html/runtime/nginx
# ---- Step 4: Output parameters and start services ---- # ---- Step 4: Output parameters and start services ----
echo "参数为:$@" echo "参数为:$@"

View File

@@ -0,0 +1,6 @@
# ulthon_admin nginx_log 分析专用 log_format
# 必须放在 nginx 的 http 块(通过 conf.d/*.conf 自动 include
log_format analytics '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $bytes_sent';

View File

@@ -14,6 +14,9 @@ server {
# 运行时长不限制 # 运行时长不限制
fastcgi_read_timeout 60000; fastcgi_read_timeout 60000;
# ulthon_admin nginx_log 分析access_log 写到 runtime持久化 + PHP 必能读)
access_log /var/www/html/runtime/nginx/access.log analytics;
location / { location / {
if (!-e $request_filename) { if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last; break; rewrite ^(.*)$ /index.php?s=$1 last; break;

View File

@@ -24,6 +24,13 @@ mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage
mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace
# 复制 nginx_log 分析的 log_format 配置到 nginx http 块conf.d 自动 include
cp "$SCRIPT_DIR/nginx-log-format.conf" /etc/nginx/conf.d/
# 创建 nginx access_log 目录(必须在 service nginx start 之前)
mkdir -p /var/www/html/runtime/nginx && chmod 777 /var/www/html/runtime/nginx
# 运行redis # 运行redis
# nohup redis-server --requirepass "" & # nohup redis-server --requirepass "" &

View File

@@ -0,0 +1,6 @@
# ulthon_admin nginx_log 分析专用 log_format
# 必须放在 nginx 的 http 块(通过 conf.d/*.conf 自动 include
log_format analytics '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $bytes_sent';

View File

@@ -14,6 +14,9 @@ server {
# 运行时长不限制 # 运行时长不限制
fastcgi_read_timeout 60000; fastcgi_read_timeout 60000;
# ulthon_admin nginx_log 分析access_log 写到 runtime持久化 + PHP 必能读)
access_log /var/www/html/runtime/nginx/access.log analytics;
location / { location / {
if (!-e $request_filename) { if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last; break; rewrite ^(.*)$ /index.php?s=$1 last; break;

View File

@@ -20,6 +20,13 @@ mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage
mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace
# 复制 nginx_log 分析的 log_format 配置到 nginx http 块conf.d 自动 include
cp "$SCRIPT_DIR/nginx-log-format.conf" /etc/nginx/conf.d/
# 创建 nginx access_log 目录(必须在 service nginx start 之前)
mkdir -p /var/www/html/runtime/nginx && chmod 777 /var/www/html/runtime/nginx
# 运行redis # 运行redis
# nohup redis-server --requirepass "" & # nohup redis-server --requirepass "" &

View File

@@ -0,0 +1,6 @@
# ulthon_admin nginx_log 分析专用 log_format
# 必须放在 nginx 的 http 块(通过 conf.d/*.conf 自动 include
log_format analytics '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $bytes_sent';

View File

@@ -14,6 +14,9 @@ server {
# 运行时长不限制 # 运行时长不限制
fastcgi_read_timeout 60000; fastcgi_read_timeout 60000;
# ulthon_admin nginx_log 分析access_log 写到 runtime持久化 + PHP 必能读)
access_log /var/www/html/runtime/nginx/access.log analytics;
location / { location / {
if (!-e $request_filename) { if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last; break; rewrite ^(.*)$ /index.php?s=$1 last; break;

View File

@@ -20,6 +20,13 @@ mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage
mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace
# 复制 nginx_log 分析的 log_format 配置到 nginx http 块conf.d 自动 include
cp "$SCRIPT_DIR/nginx-log-format.conf" /etc/nginx/conf.d/
# 创建 nginx access_log 目录(必须在 service nginx start 之前)
mkdir -p /var/www/html/runtime/nginx && chmod 777 /var/www/html/runtime/nginx
# 运行redis # 运行redis
# nohup redis-server --requirepass "" & # nohup redis-server --requirepass "" &