服務器部署了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、查看日志是否存在,點開網頁測試

測試沒有問題。
