From fcd2b284c905b996f6473ccdc23973c9d2c848a0 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Wed, 22 Nov 2023 18:19:46 +0800 Subject: [PATCH] fix bug --- nginx/conf/nginx.conf | 10 +++++----- nginx/docker-compose.yml | 4 +++- nginx/sh/run.sh | 24 ++++-------------------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/nginx/conf/nginx.conf b/nginx/conf/nginx.conf index 679c3ce..0eedbd8 100644 --- a/nginx/conf/nginx.conf +++ b/nginx/conf/nginx.conf @@ -1,7 +1,7 @@ user root; worker_processes auto; worker_rlimit_nofile 50000; -error_log /data/xcdn/logs/error.log; +error_log /usr/local/nginx/logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; @@ -25,10 +25,10 @@ stream { '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; #stream日志路径 - access_log /data/xcdn/logs/stream-access.log proxy; + access_log /usr/local/nginx/logs/stream-access.log proxy; open_log_file_cache off; #载入stream配置 - include /data/xcdn/conf/stream/*.conf; + include /usr/local/nginx/conf/stream/*.conf; } http { @@ -113,6 +113,6 @@ http { } } #载入额外的配置 - include /data/xcdn/conf/cdn/*.conf; - include /data/xcdn/conf/vhost/*.conf; + include /usr/local/nginx/conf/cdn/*.conf; + include /usr/local/nginx/conf/vhost/*.conf; } diff --git a/nginx/docker-compose.yml b/nginx/docker-compose.yml index 9a7153e..3624287 100644 --- a/nginx/docker-compose.yml +++ b/nginx/docker-compose.yml @@ -8,8 +8,10 @@ services: network_mode: "host" volumes: - ../wwwroot:/var/www/html - - ./data:/data/xcdn - ./conf/nginx.conf:/usr/local/nginx/conf/nginx.conf + - ./conf/vhost:/usr/local/nginx/conf/vhost + - ./conf/stream:/usr/local/nginx/conf/stream + - ./logs:/usr/local/nginx/logs restart: always \ No newline at end of file diff --git a/nginx/sh/run.sh b/nginx/sh/run.sh index 5be1eca..2ba5466 100644 --- a/nginx/sh/run.sh +++ b/nginx/sh/run.sh @@ -5,32 +5,16 @@ #Github:https://github.com/helloxz/xcdn ####################### END ####################### -#创建xcdn所需目录 -function create_dir(){ - #创建配置文件夹 - mkdir -p /data/xcdn/conf/vhost; - mkdir -p /data/xcdn/conf/cdn; - mkdir -p /data/xcdn/conf/stream; - - #创建日志文件夹 - mkdir -p /data/xcdn/logs; - touch /data/xcdn/logs/error.log - #创建ssl证书文件夹 - mkdir -p /data/xcdn/ssl; - #创建缓存文件夹 - mkdir -p /data/xcdn/caches; - chmod -R 777 /data/xcdn/caches; -} #运行时检查 function run_check(){ #检查nginx日志是否存在,如果不存在则创建 - if [ ! -f "/data/xcdn/logs/error.log" ] + if [ ! -f "/usr/local/nginx/logs/error.log" ] then #创建日志文件夹 - mkdir -p /data/xcdn/logs; - touch /data/xcdn/logs/error.log - touch /data/xcdn/logs/stream-access.log + # mkdir -p /data/xcdn/logs; + touch /usr/local/nginx/logs/error.log + touch /usr/local/nginx/logs/stream-access.log fi }