如何搭建代理服务器
2023年1月25日发(作者:感谢师恩的诗句)
Nginx搭建正向代理服务器⽀持https
1,下载并解压模块githup地址
unzipngx_http_proxy_connect_
2,切换到服务器源码包位置
cd/usr/local/tools/nginx-1.14.2
3,配置编译注意版本对应关系
patch-p1
./configure--prefix=/usr/local/nginx--with-select_module--with-poll_module--with-file-aio--with-http_ssl_module--with-http_realip_module--with-http_addition_module--with-http_xslt_module--with-http_sub_module--with-http_dav_module--with-h
make
只make不makeinstall,会在当前⽬录的objs⽂件夹下⽣成名字为”nginx“的执⾏⽂件
4,备份原来的nginx执⾏⽂件拷贝新的过去
cpobjs/nginx/usr/local/nginx/sbin/
5,编写正向代理服务器配置⽂件
server{
resolver114.114.114.114ipv6=off;
resolver_timeout10s;
listen8080;
proxy_connect;
proxy_connect_allow44380563;
proxy_connect_connect_timeout20s;
proxy_connect_read_timeout20s;
proxy_connect_send_timeout20s;
location/{
proxy_passhttp://$host;
proxy_set_headerHost$host;
}
}
6,重启nginx完成配置。