Linux设置http/https代理的方法
有些linux服务器处于内网,并且没有公网ip,故要想与外网进行http/https通信只能通过nat或者加proxy的方式。nat服务器有网段的限制,而http/https proxy代理则没有,使用起来也方便。
linux系统设置http/https proxy的方法,在/etc/bashrc或者/etc/profile中添加如下环境变量:
export http_proxy=http://192.168.0.12:8081
export https_proxy=http://192.168.0.12:8081
对那些没有域名解析通过绑定hosts文件来访问的域名,不让其走http/https代理,在/etc/bashrc或者/etc/profile中添加如下环境变量:
export no_proxy='test.sunkai.net,127.0.0.1,192.168.0.111'
正向代理,推荐使用 squid,稳定简单好用,支持http/https协议
# cat /etc/squid/squid.conf
http_access allow all
http_port 8081
cache deny all