Nginx
1 前言
一个问题,一篇文章,一出故事。
笔者需要分享Squid日志给开发人员调试,于是想到使用Nginx分享日志。
2 最佳实践
2.1 安装Nginx
2.2 安装Nginx
vim /etc/nginx/nginx.conf
加入如下配置,
server {
#...
location /log {
alias /var/log/squid;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
allow 10.0.0.0/8;
allow 172.16.0.0/12;
allow 192.168.0.0/16;
deny all;
default_type text/plain;
types {
log txt;
}
}
}
根据以上配置,你需要设置访问密码,
dnf install httpd-tools htpasswd -cb /etc/nginx/.htpasswd admin 'adminpwd'
2.3 重载使配置生效
systemctl restart nginx
没有评论