代理_nginx_proxy
Posted Le1543
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了代理_nginx_proxy相关的知识,希望对你有一定的参考价值。
192.168.3.22 mariadb 略
192.168.3.21 proxy_nginx
21host:安装nginx
[root@localhost conf.d]# cat /etc/nginx/proxy_params
proxy_set_header Host $http_host; //把域名也传到nginx
proxy_set_header X-Real-IP $remote_addr; //把客户端IP通过变量存放并传到nginx
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;//让nginx后端记录客户端真实地址
proxy_connect_timeout 30; //代理向后端链接超时时间
proxy_send_timeout 60; //代理等待后端响应时间
proxy_read_timeout 60; //后端代理回传超时时间
proxy_buffering on; //代理把数据放缓冲区,on(默认)
proxy_buffer_size 32k; //代理保存用户头信息缓冲区大小
proxy_buffers 4 128k; //缓冲区
---------------------------------------------------------------------------------------------------------
[root@localhost conf.d]# vim default.conf
server {
listen 80;
server_name www.le.com;
location / {
proxy_pass http://192.168.3.222:80;
include proxy_params;
}
}
-------------------------------------------------------------------------------------------------------
nginx -t
systemctl restart nginx
[root@localhost conf.d]# cat /etc/nginx/proxy_params proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 30;proxy_send_timeout 60;proxy_read_timeout 60;
proxy_buffering on;proxy_buffer_size 32k;proxy_buffers 4 128k;
以上是关于代理_nginx_proxy的主要内容,如果未能解决你的问题,请参考以下文章