Nginx 配置改不了 TIM截图20190923153207.png(57.68 KB, 下载次数: 0)

24 分钟前 上传

点击文件名下载附件

  1. location /ws{
  2. set $flag 0;
  3. if ($host != ‘xxx.com’) {
  4. set $flag 1;
  5. }
  6. if ($server_port = 80) {
  7. set $flag 1;
  8. }
  9. if ($scheme = http) {
  10. set $flag 1;
  11. }
  12. if ($http_user_agent ~* (baiduspider|soso|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)){
  13. set $flag 2;
  14. }
  15. if ($flag = 1){#正常http请求
  16. rewrite ^/(.*)$ http://baidu.com/;
  17. }
  18. if ($flag = 2){#爬虫
  19. rewrite ^/(.*)$ http://baidu.com/;
  20. }
  21. proxy_pass http://127.0.0.1:10000;#这里输入之前的v2ray端口
  22. proxy_set_header Host $host:$server_port;
  23. proxy_http_version 1.1;
  24. proxy_set_header Upgrade $http_upgrade;
  25. proxy_set_header Connection "upgrade";
  26. }

复制代码

重庆网友:test failed代表配置文件有问题啊 测试不通过自然不让你保存了
山西网友:好吧  再研究下

01-25 09:45