Browse Source

fix bug

main
xiaoz 6 months ago
parent
commit
fcd2b284c9
  1. 10
      nginx/conf/nginx.conf
  2. 4
      nginx/docker-compose.yml
  3. 24
      nginx/sh/run.sh

10
nginx/conf/nginx.conf

@ -1,7 +1,7 @@ @@ -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 { @@ -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 { @@ -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;
}

4
nginx/docker-compose.yml

@ -8,8 +8,10 @@ services: @@ -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

24
nginx/sh/run.sh

@ -5,32 +5,16 @@ @@ -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
}

Loading…
Cancel
Save