关于搭建代理服务器的方法,我也是刚刚接触,从网上找了一些能够行得通的方法来给大家做个分享:
这里我用的是Tinyproxy作为代理服务软件。这个东西很小,并没有几M。
tinyproxy最大的特点就是小,功能简单,配置简单

CopyCopydebian系:apt-get install tinyproxy
centos系:yum install tinyproxy

systemctl status tinyproxy.service

结果如下:

 tinyproxy.service - Tinyproxy lightweight HTTP Proxy
   Loaded: loaded (/lib/systemd/system/tinyproxy.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-08-31 10:19:53 CST; 11s ago
     Docs: man:tinyproxy(8)
           man:tinyproxy.conf(5)
 Main PID: 15247 (tinyproxy)
    Tasks: 11 (limit: 4915)
   Memory: 3.3M
   CGroup: /system.slice/tinyproxy.service
           ├─15247 /usr/bin/tinyproxy
           ├─15259 /usr/bin/tinyproxy
           ├─15261 /usr/bin/tinyproxy
           ├─15262 /usr/bin/tinyproxy
           ├─15263 /usr/bin/tinyproxy
           ├─15265 /usr/bin/tinyproxy
           ├─15268 /usr/bin/tinyproxy
           ├─15269 /usr/bin/tinyproxy
           ├─15270 /usr/bin/tinyproxy
           ├─15271 /usr/bin/tinyproxy
           └─15273 /usr/bin/tinyproxy

代理服务器,配置

编辑配置/etc/tinyproxy/tinyproxy.conf:
(1)找到Allow 127.0.0.1行,前面加上#号将其注释掉。
(2)Port 8888:默认开放的端口为8888(可自行更改)
CopyCopy执行/etc/init.d/tinyproxy restart使配置生效,或者执行systemctl restart tinyproxy.service
(3)如果希望每次开机代理自动启动可以使用一下命令:

systemctl enable tinyproxy.service

客户端电脑,使用

其他电脑上,在linux终端下,可直接输入以下指令,进行代理:
export http_proxy=http://xxxxxx:xxxx
export https_proxy=http://xxxxxx:xxxx
取消代理
unset http_proxy https_proxy。

这个时候客户端的电脑上网,可以通过代理服务器进行访问。
在这里插入图片描述

关于lin搭建代理服务器的方法这里我用的是Tinyproxy作为代理服务软件。这个东西很小,并没有几M。tinyproxy最大的特点就是小,功能简单,配置简单安装CopyCopydebian系:apt-get install tinyproxycentos系:yum install tinyproxy检查systemctl status tinyproxy.service结果如下: tinyproxy.service - TinyProxy介绍 TinyProxy是轻量级的开源 HTTP/HTTPS 代理守护程序(轻量级http代理服务器),它从一开始就设计得既快又小,是一个理想的解决方案,适用于需要全功能HTTP代理的嵌入式部署等用例,但无法使用较大代理的系统资源。 ·占用少量的系统资源 ·兼容性不错 下载tinyproxy软件 如需要,请点击tinyproxy-1.... wget -P /opt/software https://github.com/tinyproxy/tinyproxy/releases/download/1.11.0-rc1/tinyproxy-1.11.0-rc1.tar.gz mkdir /opt/module cd /opt/software tar -zxvf tinyproxy-1.11.0-rc1.tar.g
1. 安装代理软件tinyproxy TinyProxy和 Squid 都是比较优秀的代理软件 TinyProxy比较小众,虽然没有Squid的功能丰富,但是小巧简单,也能满足一般的用户需求。 Squid是一款优秀的代理软件,有很丰富的ACL管理功能,虽然squid很强大,但配置较繁琐 有公网IP的服务器上 CentOS 安装 TinyProxy yum install ...
vi /etc/tinyproxy/tinyproxy.conf Port 8888 //预设是8888 Port,你可以更改 Allow 127.0.0.1 // 允许的IP地址, 将127.0.0.1改成你自己的IP //Allow 192.168.1.0/24 #表示一个网络的IP //例如你的IP 是1.2.3.4,你改成Allow 1.2.3.4,那只有你才可以连上这个Proxy //若你想任何IP都可以连到Proxy
Linux MQTT服务器搭建需要以下步骤: 1. 安装Mosquitto:Mosquitto是一个流行的MQTT代理,可以在Linux上安装。使用以下命令安装Mosquitto: sudo apt-get install mosquitto 2. 安装Mosquitto客户端:Mosquitto客户端是用于连接到Mosquitto代理的工具。使用以下命令安装Mosquitto客户端: sudo apt-get install mosquitto-clients 3. 配置Mosquitto:默认情况下,Mosquitto代理将监听1883端口。您可以通过编辑Mosquitto配置文件来更改此端口。使用以下命令打开Mosquitto配置文件: sudo nano /etc/mosquitto/mosquitto.conf 4. 启动Mosquitto:使用以下命令启动Mosquitto代理: sudo systemctl start mosquitto 5. 测试Mosquitto:使用以下命令测试Mosquitto代理是否正在运行: mosquitto_sub -h localhost -t test 如果一切正常,您应该能够看到Mosquitto代理接收到的消息。 以上就是Linux MQTT服务器搭建的基本步骤。