win中简单nginx代理

window:下载nginx
在nginx.conf文件中配置
正向代理:
server {
# listen 80;
# server_name localhost;

    resolver 8.8.8.8;
    resolver_timeout 30s; 
    listen 81;
    location / {
            proxy_pass http://$http_host$request_uri;
            proxy_set_header Host $http_host;
            proxy_buffers 256 4k;
            proxy_max_temp_file_size 0;
            proxy_connect_timeout 30;
            proxy_cache_valid 200 302 10m;
            proxy_cache_valid 301 1h;
            proxy_cache_valid any 1m;
    }

}

反向代理:
在server中

#    location / {    #默认配置

root html;

index index.html index.htm;

}

 #   location / {     #静态服务器
 #   	root D:/go;
   #autoindex on;

}

 #   location /baidu/ {     #反向代理
 #   	proxy_pass https://www.baidu.com/;
 #   }

#    location /tianmao/ {     #反向代理
#    	proxy_pass https://www.tmall.com/;
#    }

#    location /123/ {     #反向代理
#    	proxy_pass http://192.168.148.128:8000/;
#    }

curl -i --proxy 192.168.128.38:81 http://192.168.128.38:8000/ergodic_meta/
或者
curl -x 192.168.128.38:81 192.168.148.128:8000/ergodic_meta/

start nginx.exe 开始
nginx.exe -s stop 停止
nginx.exe -s reload

ubuntu中:docker容器中运行:
创建新镜像:docker build

docker pull asappinc/ubuntu20_python38
docker images
docker run imagesid
docker ps -a
docker start imagesid

docker run -itd --name=Junhao --net host asappinc/ubuntu20 #docker仅主机模式 可访问外网
docker pull asappinc/ubuntu20_python38

ubuntu安装nginx
https://blog.csdn.net/weixin_42599091/article/details/105860377?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-10.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-10.no_search_link

配置正向:
https://blog.csdn.net/weixin_47003048/article/details/108436853?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163401905216780274119797%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=163401905216780274119797&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-6-108436853.first_rank_v2_pc_rank_v29&utm_term=ubuntu+nginx%E6%AD%A3%E5%90%91%E4%BB%A3%E7%90%86&spm=1018.2226.3001.4187

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值