标签:大小 查看 级别 mic live div volumes alt 一个
服务器部署了nginx镜像,所以加入一个日志查看,添加一下静态页面下载。
1、查看nginx镜像怎么部署的
nginx:
image: nginx
ports:
- ‘80:80‘
volumes:
- "/etc/localtime:/etc/localtime:ro"
- ‘./nginx/nginx.conf:/etc/nginx/nginx.conf:ro‘
- ‘./nginx/conf.d:/etc/nginx/conf.d:ro‘
- ‘./nginx/www:/usr/share/nginx/html:ro‘
- ‘./nginx/log:/var/log/nginx‘(:ro 是只读不能写)
restart: always
2、修改nginx.cof文件
tcp_nopush on;
keepalive_timeout 60;
gzip on; # 启用gzip压缩
gzip_buffers 16 8k;
gzip_comp_level 5; # 压缩级别,1 - 9,数字越大压缩的越好,也越占用CPU时间
gzip_min_length 100; # 最小压缩文件大小,小于设置值的文件将不会压缩
gzip_proxied any;
gzip_types text/plain text/css text/javascript; # 压缩类型,mime.types 文件可以查看
gzip_vary on; # 是否在http header中添加Vary: Accept-Encoding,建议开启
server {
listen 80; # 监听端口
server_name localhost; # nginx虚拟主机名,IP或域名
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html/download;
index index.html;
}
location /android {
alias www/android;
autoindex on;
}
location /ios {
alias www/ios;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
3、查看日志是否存在,点开网页测试

测试没有问题。
docker-compose中加入nginx 日志和部署下载
标签:大小 查看 级别 mic live div volumes alt 一个
原文地址:https://www.cnblogs.com/liubiaos/p/11302359.html