feat(docker): 更新 Nginx 配置并注释 Dockerfile

- 在 default.conf 中添加了访问日志和错误日志配置
- 新增了日志文件访问接口
- 注释掉了 Dockerfile 中的配置文件复制指令
This commit is contained in:
Huangzhe
2025-05-27 21:58:20 +08:00
parent 73841a2d07
commit d49f856fd0
2 changed files with 15 additions and 1 deletions

View File

@@ -14,6 +14,6 @@ COPY ${DIST_DIR} /var/www/html/${URL_DIR}
RUN sed -i "s/\ \/index.html/\ \/${URL_DIR}\/index.html/g" /etc/nginx/conf.d/default.conf
# 默认不建议使用自定义nginx配置如必须使用请提前沟通
COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
# COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

View File

@@ -11,6 +11,20 @@ server {
try_files $uri $uri/ //index.html;
}
# 启用访问日志,并指定日志文件路径和格式
access_log /var/log/nginx/host.access.log;
# 打印错误日志文件信息
error_log /var/log/nginx/host.error.log;
location /yllog {
root /var/log/nginx;
autoindex on;
}
# 定义日志格式(通常在 http 块中定义即可)
# log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;