前沿:正向代理:正向代理简单来说:客户端已知目标服务器地址但无法访问目标服务器(如:墙),从而先访问代理服务器,通过代理服务器访问目标服务器,返回结果。
正向代理:代理的是客户端
正向代理配置:nginx.conf
#user nobody;
worker_processes 1;//进程数
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;//最大连接数
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 88; #监听端口
resolver 183.60.82.98; #dns解析地址,
//中国区域默认dns解析地址:114.114.114.114
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass https://$host$request_uri; #设定http代理服务器的协议和地址
proxy_set_header HOST $host;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
#root html;
#index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
https正向代理:具体参考https://www.jianshu.com/p/eb70d1dc1559