1、PC上啟動代理,比如nginx
下載nginx:http://nginx.org/en/download.html
修改配置文件,在conf下:
http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;server {listen 888;server_name localhost;location / { proxy_pass http://archive.ubuntu.com; proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}}
2、啟動ssh
ssh -R localhost:xxx1:localhost:xxx2 username@服務器IP
參數分別是:服務器端口:PC主機:PC端口
連上后設置代理:
export {http,https}_proxy='localhost:xxx1'
這時總體拓撲為: