feat(docker): 更新 Nginx 配置并注释 Dockerfile
- 在 default.conf 中添加了访问日志和错误日志配置 - 新增了日志文件访问接口 - 注释掉了 Dockerfile 中的配置文件复制指令
This commit is contained in:
@@ -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
|
RUN sed -i "s/\ \/index.html/\ \/${URL_DIR}\/index.html/g" /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# 默认不建议使用自定义nginx配置,如必须使用,请提前沟通
|
# 默认不建议使用自定义nginx配置,如必须使用,请提前沟通
|
||||||
COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
|
# COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -11,6 +11,20 @@ server {
|
|||||||
try_files $uri $uri/ //index.html;
|
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
|
# redirect server error pages to the static page /50x.html
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
|||||||
Reference in New Issue
Block a user