nginx负载均衡基本配置和日志按天写
简单记录一下。
upstream dynamic_pools{
server 127.0.0.1:8080;
}
#动态命令转交给后端
location /api
{
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_pass http://dynamic_pools;
}
日志配置(写在server块的开头):
server {
if ($time_iso8601 ~ '(\d{4}-\d{2}-\d{2})') {
set $tttt $1;
}
access_log logs/$tttt.access.log main;
.......
}