日志、禁止指定网段访问、缓存时长
test.conf
server {
listen 80;
server_name test.yunwei361.com;
root /usr/share/nginx/html/test;
access_log /var/log/nginx/test.access.log main;
error_log /var/log/nginx/test.error.log notice;
location / {
index index.html index.htm;
}
location /admin/ {
# 允许172.31.45.0/24 网段访问
allow 172.31.45.0/24;
# 拒绝所有
deny all;
}
# 设置缓存时长
location ~* \.(html|css|js)$ {
# max 的时长为10年
expires max;
}
location ~* \.(jpg|jpeg|png|gif|bmp)$ {
expires 1h;
}
}指定网段访问测试
缓存时长查看

Last updated