dev
Administrator 2024-05-20 02:08:54 +08:00
parent 80de9f4a9c
commit e1a787e310
2 changed files with 1 additions and 44 deletions

View File

@ -3,6 +3,6 @@ USER root
ENV TZ=Asia/Shanghai
COPY aiweek /usr/local/bin/
COPY ./option/option.yaml /conf/
RUN chmod +x /usr/local/bin/aiweek && mkdir /data /conf
RUN chmod +x /usr/local/bin/aiweek && mkdir /data
ENTRYPOINT ["aiweek"]
CMD ["--livemode=false"]

View File

@ -1,43 +0,0 @@
#!/usr/bin/bash
CONFIG_FILE="/etc/nginx/nginx.conf"
CONFIG_BLOCK=$(cat <<EOF
autoindex on; # 显示目录
autoindex_exact_size on; # 显示文件大小
autoindex_localtime on; # 显示文件时间
server {
listen 233 default_server;
listen [::]:233 default_server;
server_name _;
root /data/;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
EOF
)
yum -y install nginx
if [ ! -f "$CONFIG_FILE" ]; then
echo "配置文件不存在: $CONFIG_FILE"
exit 1
fi
sed -i 's/^user nginx;/user root;/' "$CONFIG_FILE"
if [ $? -eq 0 ]; then
echo "用户配置文件已更新。"
else
echo "更新用户配置文件失败。"
fi
sed -i '/^http\s*{/,/^}/a '"$CONFIG_BLOCK" "$NGINX_CONFIG"
if [ $? -eq 0 ]; then
echo "fileserver配置文件已更新。"
else
echo "更新fileserver配置文件失败。"
fi
nginx -s reload