千万个美丽的未来,抵不上一个温暖的现在,每一个真实的现在,都是我们曾经幻想的未来!
May
16
LVS:略
nginx proxy 配置:
location / {
root /data/www/wwwroot/bbs.linuxtone.com;
proxy_redirect off ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 60;
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
proxy_pass http://bbs.linuxtone.org;
}
源nginx配置:
安装
HttpRealIpModule模块:
http://wiki.nginx.org/NginxChsHttpRealIpModule
--with-http_realip_module
编译方法:
./configure --user=daemon --group=daemon --prefix=/usr/local/nginx/
--with-http_stub_status_module --with-http_ssl_module
--with-http_sub_module --with-md5=/usr/lib --with-sha1=/usr/lib
--with-http_gzip_static_module --with-http_realip_module
虚拟主机增加配置:
set_real_ip_from nginx_proxy_ip/24;
set_real_ip_from nginx_proxy_ip;
real_ip_header X-Real-IP;
EXP:
set_real_ip_from 192.168.1.0/24;
set_real_ip_from 192.168.1.6;
real_ip_header X-Real-IP;
查看二台nginx的日志就能取到真实IP了
nginx proxy 配置:
引用
location / {
root /data/www/wwwroot/bbs.linuxtone.com;
proxy_redirect off ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 60;
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
proxy_pass http://bbs.linuxtone.org;
}
源nginx配置:
安装
HttpRealIpModule模块:
http://wiki.nginx.org/NginxChsHttpRealIpModule
--with-http_realip_module
编译方法:
引用
./configure --user=daemon --group=daemon --prefix=/usr/local/nginx/
--with-http_stub_status_module --with-http_ssl_module
--with-http_sub_module --with-md5=/usr/lib --with-sha1=/usr/lib
--with-http_gzip_static_module --with-http_realip_module
虚拟主机增加配置:
set_real_ip_from nginx_proxy_ip/24;
set_real_ip_from nginx_proxy_ip;
real_ip_header X-Real-IP;
EXP:
set_real_ip_from 192.168.1.0/24;
set_real_ip_from 192.168.1.6;
real_ip_header X-Real-IP;
查看二台nginx的日志就能取到真实IP了