centos7 使用ss和Privoxy 实现命令行访问google
yum -y upgrade
yum install -y epel-release
yum install -y python-pip
#安装完成后需要更新一下
pip install --upgrade pip
#install ss pip install shadowsocks #install privoxy yum install -y privoxy
vim /etc/shadowsocks.json 添加以下内容 { "server": "156.12.22.29", "server_port": "55555", "local_address": "127.0.0.1", "local_port": "6666", "password": "service_password", "method": "aes-256-cfb", "timeout": "300", "workers": "1" }
每个字段解释
vim /etc/privoxy/config # 确认下面这一行没有被注释掉 listen-address 127.0.0.1:8118 ## 默认端口是8118,不需要修改 # 新增一行 forward-socks5t / 127.0.0.1:6666 . ## 端口必须与 /etc/shadowsocks.json 中 local_port 字段的值相同, ## 注意:行尾有一个英文句号(.)
# 以 daemon 模式启动 [root@centos-linux ~]# sslocal -c /etc/shadowsocks.json -d start INFO: loading config from /etc/shadowsocks.json 2019-02-26 23:30:12 INFO loading libcrypto from libcrypto.so.10 started # 确认 sslocal 已监听在预设端口 lsof -i | grep sslocal [root@centos-linux ~]# lsof -i | grep sslocal sslocal 24367 root 4u IPv4 53001198 0t0 TCP localhost:ircu-2 (LISTEN) sslocal 24367 root 5u IPv4 53001199 0t0 UDP localhost:ircu-2 [root@centos-linux ~]# curl --socks5 127.0.0.1:6666 http://httpbin.org/ip { "origin": "156.12.22.29, 156.12.22.29" # 注意 :: 必须与 /etc/shadowsocks.json 中 server 字段的值相同 }
systemctl start privoxy
[root@centos-linux ~]# curl --proxy https://127.0.0.1:8118 -Is https://google.com | grep -w 200 HTTP/1.1 200 Connection established
sh -c 'echo "sudo /usr/bin/sslocal -c /etc/shadowsocks.json -d start" >> /etc/rc.d/rc.local' # 如果 rc.local 没有可执行权限就给它加上 systemctl enable privoxy
#启用代理 export http_proxy='127.0.0.1:8118' export https_proxy='127.0.0.1:8118' # 停用代理 export http_proxy='' export https_proxy=''
curl -I https://golang.org/ #执行命令后出现如下信息,说明成功 [root@centos-linux ~]# curl -I https://golang.org/ HTTP/1.1 200 Connection established HTTP/1.1 200 OK Date: Tue, 26 Feb 2019 15:41:47 GMT Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Via: 1.1 google Transfer-Encoding: chunked Alt-Svc: quic=":443"; ma=2592000; v="44,43,39"
#创建文件 /etc/profile.d/vm-proxy.sh,文件内容如下 [root@centos-linux ~]# cat /etc/profile.d/vm-proxy.sh function cmd-proxy-on { export no_proxy="127.0.0.1,localhost,localaddress,.localdomain.com,tencentyun.com"; export http_proxy='127.0.0.1:8118'; export https_proxy=$http_proxy; echo 'HTTP proxy started.' } export -f cmd-proxy-on # 第二种声明函数的方式 cmd-proxy-off() { unset http_proxy; unset https_proxy; echo 'HTTP proxy stopped.' } export -f cmd-proxy-off
#source 脚本 chmod +x /etc/profile.d/vm-proxy.sh source /etc/profile.d/vm-proxy.sh
[root@centos-linux ~]# vim /etc/profile.d/vm-proxy.sh [root@centos-linux ~]# chmod +x /etc/profile.d/vm-proxy.sh [root@centos-linux ~]# source /etc/profile.d/vm-proxy.sh [root@centos-linux ~]# cmd-proxy-on HTTP proxy started. [root@centos-linux ~]# curl -I https://golang.org/ HTTP/1.1 200 Connection established HTTP/1.1 200 OK Date: Tue, 26 Feb 2019 15:47:18 GMT Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Via: 1.1 google Transfer-Encoding: chunked Alt-Svc: quic=":443"; ma=2592000; v="44,43,39" [root@centos-linux ~]# cmd-proxy-off HTTP proxy stopped. [root@centos-linux ~]# curl -I https://golang.org/ curl: (7) Failed connect to golang.org:443; 拒绝连接
centos7 使用ss和Privoxy 实现命令行访问google的更多相关文章
- 使用 grpcurl 通过命令行访问 gRPC 服务
原文链接: 使用 grpcurl 通过命令行访问 gRPC 服务 一般情况下测试 gRPC 服务,都是通过客户端来直接请求服务端.如果客户端还没准备好的话,也可以使用 BloomRPC 这样的 GUI ...
- Centos7修改默认启动级别(命令行,图形切换)
方法一: 终端输入以下命令 修改为命令行方式 systemctl set-default multi-user.target 修改为图形界面 systemctl set-default graphic ...
- centos7更改为启动桌面或命令行模式
进入cenos7的命令行模式 终端输入“init 3”回车进入命令行模式 登录成功后 # systemctl get-default //获取当前系统启动模式 查看配置文件 # cat /etc/in ...
- Linux命令行访问网页
找到个好资料,备份行: http://hi.baidu.com/oyvfhp/blog/item/3aa5ced5b40563d351da4bb0.html CURL --- 命令行浏览器 这东西 ...
- Node.js(window)基础(1)——用cmd命令行访问某一文件夹下的js文件
一.安装,从官网上下载安装,安装基本一直点击下一步就行.注意:node.js基于Python的,安装node.js之前电脑上要安装Python,最好是Python2.7或2.6. 二.cmd进入命令行 ...
- 强悍的 ubuntu —— 命令行访问网页
所谓以命令行的方式访问网页,即是在终端下以文本的形式访问网站,这里推荐一个工具:w3m, $ sudo apt-get install w3m $ w3m www.baidu.com
- thinkphp5命令行访问
入口文件后加一个空格就行了 1,首先cd到站点目录public下,我的入口文件是默认的index.php,然后执行以下命令, 2,php要加入环境变量 访问index模块下的index控制器下的tes ...
- 命令行访问远程mysql数据库
命令: mysql -u用户名 -p密码 -h远程数据库IP地址 -P端口 -D数据库名 例子: 使用用root帐号,密码为123456,登录ip地址为192.168.1.110,端口为3306,名称 ...
- Ubuntu下命令行访问网站
第一步,需要安装一个名为w3m的软件工具,打开终端,输入如下命令 sudo apt-get install w3m 第二步,安装好w3m之后,在终端里面启动w3m,打开一个网址,比如w3m www ...
随机推荐
- OpenCV中Mat的使用
一.数字图像存储概述 数字图像存储时,我们存储的是图像每个像素点的数值,对应的是一个数字矩阵. 二.Mat的存储 1.OpenCV1基于C接口定义的图像存储格式IplImage*,直接暴露内存,如果忘 ...
- sql中的等于和不等于, '=' ,'!=','<>','is null'....
不等于:<> ,!=,~= ,^= 这四个符号据说都可以在oracle中表示不等于,但是试了之后发现<> ,!= ,^=是可以的,~=不行,需要注意的是,只有<>是 ...
- Python-10 字典dict
#1 创建 dict1={'欢欢':'i love','小高高':'you'} dict2={1:'one',2:'two',3:'three'} dict3={} #2 访问元素 print('欢欢 ...
- NOIP 2018 Day1
Fei2Xue@Lian$Tian! 三道原题qwq真的凉 半年前看到有人发说说,梦见省选打开题目,是Please contact lydsy2012@163.com! 没想到一语成谶 大众分300 ...
- JAVA发送HttpClient请求及接收请求结果
1.写一个HttpRequestUtils工具类,包括post请求和get请求 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 ...
- uva-757-贪心
题意:有个人要去湖里钓鱼,总共有N个湖,排成一个序列,用字母P表示湖,从湖pi 到 pi+1(下一个湖)需要ti个五分钟. 并且,每个湖里可钓出来的鱼每过五分钟就减少di.如果产出的鱼小于等于di.那 ...
- linux查看tomcat启动运行日志
1.先切换到:cd tomcat/logs 2.tail -f catalina.out 3.这样运行时就可以实时查看运行日志了
- Eclipse Tomcat部署web项目时出现There are no resources that can be added or removed from the server解决办法
问题原因是:tomcat版本和java版本不匹配.
- Java就业班day09_xml&tomcat
Xml & Tomcat Xml eXtendsible markup language 可扩展的标记语言 XML 有什么用? 可以用来保存数据 可以用来做配置文件 数据传输载体 定义xml ...
- 警惕 MySql 更新 sql 的 WHERE 从句中的 IN() 子查询时出现的性能陷阱
警惕 MySql 更新 sql 的 WHERE 从句中的 IN() 子查询时出现的性能陷阱 以下文章来源:https://blog.csdn.net/defonds/article/details/4 ...