一。代理apahce:
,1.先配置nginx配置文件:
[root@centos7 conf.d] # vim/opt/app/nginx/conf.d/wordpress。参看
服务器{
,,听,,80;
,,server_name localhost;
,,位置/{
,,proxy_pass http://192.168.1.204;
,,proxy_set_header X-Real-IP, remote_addr美元;
,,}
}
2。若apache需要看到客户端真是IP,需要修改配置文件。
vim/etc/httpd/conf/httpd.参看
LogFormat“% {X-Real-IP}我% l % u % t \ " % r \ " %祝辞s % b \ " %{推荐人}我\ \ " %{用户代理}\ ",
原来的% h改成{X-Real-IP}我这里日志里就客户端访问IP了。
二.nginx方面。
,,简单方便。深入的需要看官方文档。
[root@centos7 conf.d] #猫/opt/app/nginx/conf.d/wordpress.conf 服务器{
,,听,,80;
,,server_name localhost;
,,位置/{
,,proxy_pass http://192.168.1.204;
,proxy_set_header X-Forwarded-For proxy_add_x_forwarded_for美元;
,,}
}
,,