驽马十驾

驽马十驾,功在不舍

目录
阿里SLB使用后ECS上Nginx获取真实ip地址的配置方式
/  

阿里SLB使用后ECS上Nginx获取真实ip地址的配置方式

# user root;

worker_processes 1;

events  {

worker_connections  1024;

}

http  {

# 引入同级目录下的 mime.types

include mime.types;

default_type application/octet-stream;

log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" ';

sendfile on;

  

# 接受header 的测试

server  {

listen  8888;

server_name test.com;

location / {

root /www/51mybb;

index  index.html;

}

}

  

#官网相关

include nginx-refer-conf/xxx.conf;

include nginx-refer-conf/cdxxmx.conf;

  

# api相关

include nginx-refer-conf/test-api-cdmx.conf;

include nginx-refer-conf/api-cdmx.conf;

  

#管理相关

include nginx-refer-conf/test-manager-cdmx.conf;

include nginx-refer-conf/manager-cdmx.conf;


}

关键是 log_format中的$http_x_forwarded_for同传统的配置$remote_addr不一样

不积跬步,无以至千里。不积小流,无以成江海。
评论