mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
feat(nginx-log): 4 个 stack 模板增加 log_format 与 access_log 配置(Docker 开箱即用)
This commit is contained in:
@@ -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,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 "参数为:$@"
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 "" &
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 "" &
|
||||||
|
|
||||||
|
|||||||
6
source/stack/full/source/docker/nginx-log-format.conf
Normal file
6
source/stack/full/source/docker/nginx-log-format.conf
Normal 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';
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 "" &
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user