首页
友情链接
统计
推荐
上网导航
魔逸网盘
号卡购买
Search
1
为你的服务器添加免费的公网IPv6!
518 阅读
2
使用socat进行端口转发
354 阅读
3
Nginx反代cloudflare站点
340 阅读
4
拥有一个自己的私人网盘—Cloudreve(Linux篇)
207 阅读
5
企业网络扩容
159 阅读
默认分类
网络技术
思科模拟器
华为模拟器
企业网络构建
防火墙技术
网站教程
网站源码
登录
/
注册
Search
标签搜索
网络构建
思科模拟器
CISCO
网盘
Linux
Cloudreve
Ubuntu
Centos
bash
子网掩码
ip
网络知识
rclone
OneDrive
Windows
服务器
IPv6
Free
laomoy
累计撰写
17
篇文章
累计收到
9
条评论
首页
栏目
默认分类
网络技术
思科模拟器
华为模拟器
企业网络构建
防火墙技术
网站教程
网站源码
页面
友情链接
统计
推荐
上网导航
魔逸网盘
号卡购买
搜索到
3
篇与
的结果
2023-10-26
Nginx反代cloudflare站点
Nginx反代cloudflare站点报502或403错误解决办法{card-describe title="卡片描述"}在一次安装aapanel面板的时候 发现下载文件的时候非常慢,于是我下载了脚本文件打开发现有 echo "Selected download node..." nodes=(https://node.aapanel.com)于是就开始了“反代之路”发现并没有那么简单,因为cloudflare默认屏蔽了Nginx的反代,直接用反代配置文件肯定报502或者403,捣鼓了一下,所以就有了今天这篇文章额教程~{/card-describe}本文使用 https://node.aapanel.com/ 作为反代目标站点以下是宝塔&aapanel的Nginx默认反代配置文件#PROXY-START/ location ^~ / { proxy_pass https://node.aapanel.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_http_version 1.1; # proxy_hide_header Upgrade; #Persistent connection related configuration add_header X-Cache $upstream_cache_status; #Set Nginx Cache set $static_filevY6oU8Aw 0; if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" ) { set $static_filevY6oU8Aw 1; expires 1m; } if ( $static_filevY6oU8Aw = 0 ) { add_header Cache-Control no-cache; } } #PROXY-END/将上面的配置文件的$host改成你需要反代的目标网站{alert type="warning"}特别注意:在添加反代的时候,格式是http(s)://node.aapanel.com 修改$host的时候仅需填写目标网站的域名即可 不需要写 http(s):// 和 / 否则会报400错误。{/alert}再加这个配置 #反代CF增加规则 proxy_ssl_name $host; #把$host改成目标域名 proxy_ssl_server_name on;完整的 全局 Nginx反代配置文件如下:#PROXY-START/ location ^~ / { proxy_pass https://node.aapanel.com; proxy_set_header Host node.aapanel.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_http_version 1.1; # proxy_hide_header Upgrade; #Persistent connection related configuration #反代CF增加规则 proxy_ssl_name node.aapanel.com; #把$host改成目标域名 proxy_ssl_server_name on; add_header X-Cache $upstream_cache_status; #Set Nginx Cache set $static_filevY6oU8Aw 0; if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" ) { set $static_filevY6oU8Aw 1; expires 1m; } if ( $static_filevY6oU8Aw = 0 ) { add_header Cache-Control no-cache; } } #PROXY-END/方法二(推荐临时使用)指定 路径(aapanel) 全局反代 # PROXY-START/ location /aapanel/ { # 去掉 /aapanel 前缀后再转发 rewrite ^/aapanel(/.*)$ $1 break; proxy_pass https://node.aapanel.com; proxy_set_header Host node.aapanel.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_http_version 1.1; proxy_ssl_name node.aapanel.com; proxy_ssl_server_name on; add_header X-Cache $upstream_cache_status; set $static_file9uY9s480 0; if ($uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$") { set $static_file9uY9s480 1; expires 1m; } if ($static_file9uY9s480 = 0) { add_header Cache-Control no-cache; } } # PROXY-END/ 现在你就可以成功的反代cloudflare的站点了~
2023年10月26日
340 阅读
1 评论
25 点赞
2023-10-06
使用socat进行端口转发
今天来教大家使用socat工具进行端口转发{card-describe title="socat的介绍"}socat(Socket Cat)是一个多功能的命令行工具,用于在不同的网络通信协议之间建立连接、转发数据、调试网络应用程序等。它可以用于创建虚拟端口、代理网络流量、重定向数据流以及执行其他网络相关的任务。以下是一些 socat 的功能和用途:建立连接:socat 可以用于建立各种类型的网络连接,包括TCP、UDP、UNIX域套接字等。这对于测试网络服务或连接到远程服务器非常有用。转发数据:您可以使用 socat 将数据从一个端口或套接字传输到另一个端口或套接字。这对于端口重定向或端口转发非常有用。代理服务器:socat 可以用作代理服务器,充当数据中转站,将来自客户端的数据传递给目标服务器,并将响应返回给客户端。这对于创建自定义代理服务器非常有用。串口通信:socat 可以用于串口通信,允许您通过串口连接到设备,进行数据传输和控制。加密和解密:socat 可以与加密套接字一起使用,以确保数据在传输过程中得到加密和解密。这对于安全通信非常有用。调试网络应用程序:socat 可以用于调试网络应用程序,例如通过查看数据流量或捕获数据包来诊断问题。虚拟端口:socat 可以用于创建虚拟端口,使应用程序可以通过虚拟端口进行通信,而不是物理串口或网络套接字。文件操作:除了网络通信,socat 还可以用于文件操作,如复制、合并和转换文件。总之,socat 是一个功能强大的工具,可以用于各种网络任务,从简单的端口转发到复杂的网络调试和代理服务器设置。您可以根据需要使用 socat 来满足各种网络通信需求。请注意,socat 的使用需要一定的网络知识和谨慎,因为错误的配置可能导致安全问题或网络故障。以上介绍来自ChatGPT{/card-describe}安装:Ubuntu:sudo apt-get install socat -y Centos:sudo yum install socat -y临时转发(重启或退出终端就失效):socat TCP-LISTEN:<本服务器的端口>,fork TCP:<目标服务器的IP>:<目标服务器的端口>例如:socat TCP-LISTEN:8080,fork TCP:8.8.8.8:443临时转发(后台挂起但重启就失效)nohup socat TCP-LISTEN:<本服务器的端口>,fork TCP:<目标服务器的IP>:<目标服务器的端口> &例如:nohup socat TCP-LISTEN:8080,fork TCP:8.8.8.8:443 &永久转发(重启或退出终端不失效):用systemctl保活sudo vim /etc/systemd/system/socat.service单端口转发示例:[Unit] Description=Socat Port Forwarding Service [Service] ExecStart=/usr/bin/socat TCP-LISTEN:8080,fork TCP:8.8.8.8:443 Restart=always User=root [Install] WantedBy=multi-user.target多端口转发示例:创建一个 socat 脚本文件,例如 socat-script.sh,并添加多个 socat 命令,每个命令负责一个端口转发规则。例如:sudo vim /usr/local/bin/socat-script.shsocat-script.sh内容如下:#!/bin/bash # 切换到脚本所在的目录 cd /usr/local/bin/ # 启动 socat 以前台方式 socat TCP-LISTEN:8080,fork TCP:1.2.3.4:443 & socat TCP-LISTEN:8081,fork TCP:1.2.3.4:8443 & # 无限循环以防止脚本退出 while true; do sleep 10 done然后将 socat-script.sh 脚本文件保存在一个合适的位置,例如 /usr/local/bin 目录下,并确保它具有可执行权限:sudo chmod +x /usr/local/bin/socat-script.sh最后在 socat.service 单元文件的 ExecStart 行中执行该脚本,如下所示:sudo vim /etc/systemd/system/socat.servicesocat.service内容如下:[Unit] Description=Socat Port Forwarding Service [Service] ExecStart=/usr/local/bin/socat-script.sh Restart=always User=root Type=simple [Install] WantedBy=multi-user.target重新加载 systemd 守护进程以读取更新后的服务单元文件:sudo systemctl daemon-reload启用并启动 socat 服务sudo systemctl enable socat.service sudo systemctl start socat.service检查socat服务的状态sudo systemctl status socat.servicesudo systemctl stop socat.service # 停止服务 sudo systemctl restart socat.service # 重新启动服务PS:切记!端口不可用重复的,否则无法启动服务的!
2023年10月06日
354 阅读
0 评论
8 点赞
2023-04-23
拥有一个自己的私人网盘—Cloudreve(Linux篇)
在上一篇文章中,我们在Windows上搭建了属于自己的Cloudreve私人网盘,今天我们来学习如何在Linux下搭建Cloudreve,同样也非常简单~拥有一个自己的私人网盘—Cloudreve(Windows篇)☞点我直达今天呢就教大家做一个自己的私人网盘!Cloudreve一款支持多家云存储的开源免费云盘系统 Cloudreve官网:https://cloudreve.org/Cloudreve Github:https://github.com/cloudreve/Cloudreve这是我的网盘https://pan.myycu.cn/感兴趣的小伙伴可以去康康喔~教程开始,首先准备好你的服务器(系统linux发行版本都可以)cloudreve_3.7.1_linux_amd64.tar.gz的程序包我这里演示使用的是腾讯云的Ubuntu 18.04.4 LTS,啥居然不知道自己操作系统/版本?执行以下命令即可查看自己的操作系统/版本ubuntu@VM-4-17-ubuntu:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" ubuntu@VM-4-17-ubuntu:~${cloud title="Cloudreve_3.7.1_linux" type="default" url="https://pan.myycu.cn/s/WBwUa" password="qn0pti"/}{cloud title="Cloudreve Github_3.7.1" type="default" url="https://github.com/cloudreve/Cloudreve/releases/tag/3.7.1" password=""/}Cloudreve_3.7.1_linux 是本站提供的高速下载地址Cloudreve Github_3.7.1是官方的Release下载地址我们先下载Cloudreve的Linux程序包ubuntu@VM-4-17-ubuntu:~$ wget https://github.com/cloudreve/Cloudreve/releases/download/3.7.1/cloudreve_3.7.1_linux_amd64.tar.gz --2023-04-23 22:10:17-- https://github.com/cloudreve/Cloudreve/releases/download/3.7.1/cloudreve_3.7.1_linux_amd64.tar.gz Resolving github.com (github.com)... 20.205.243.166 Connecting to github.com (github.com)|20.205.243.166|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/120156076/c476dc07-fbdd-498c-adec-c0b64cb960f4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230423%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230423T141017Z&X-Amz-Expires=300&X-Amz-Signature=1c718bb2b49e78fd2ac696e03c37999051a1566d7b665b2bcafed4856ca5fae1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=120156076&response-content-disposition=attachment%3B%20filename%3Dcloudreve_3.7.1_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream [following] --2023-04-23 22:10:18-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/120156076/c476dc07-fbdd-498c-adec-c0b64cb960f4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230423%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230423T141017Z&X-Amz-Expires=300&X-Amz-Signature=1c718bb2b49e78fd2ac696e03c37999051a1566d7b665b2bcafed4856ca5fae1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=120156076&response-content-disposition=attachment%3B%20filename%3Dcloudreve_3.7.1_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.110.133, 185.199.111.133, ... Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 24560355 (23M) [application/octet-stream] Saving to: ‘cloudreve_3.7.1_linux_amd64.tar.gz’ cloudreve_3.7.1_linux_amd64.tar.gz 32%[===============> ] 7.57M 26.1KB/s eta 9m 8s可以看到,速度是相当的感人哈,所以推荐使用本站提供的高速下载链接来下载,下载好了以后手动上传到服务器的网站运行目录即可!(嫌麻烦的可以一直等待它下好~)这里为了大众 我就等待它下载完经过漫长的等待 总算是下载好啦~下载好了以后我们切换到root账号 并进入ubuntu用户目录下 我们可以看到有我们刚刚下载的cloudreve_3.7.1_linux_amd64.tar.gz压缩包ubuntu@VM-4-17-ubuntu:~$ sudo -i root@VM-4-17-ubuntu:~# cd /home root@VM-4-17-ubuntu:/home# ls lighthouse ubuntu root@VM-4-17-ubuntu:/home# cd ubuntu root@VM-4-17-ubuntu:/home/ubuntu# ls cloudreve_3.7.1_linux_amd64.tar.gz root@VM-4-17-ubuntu:/home/ubuntu#我们将cloudreve_3.7.1_linux_amd64.tar.gz压缩包解压为了方便管理cloudreve我们这里在新建个cloudreve文件夹,再把cloudreve程序放进去解压root@VM-4-17-ubuntu:/home/ubuntu# ls cloudreve_3.7.1_linux_amd64.tar.gz root@VM-4-17-ubuntu:/home/ubuntu# mkdir cloudreve root@VM-4-17-ubuntu:/home/ubuntu# mv cloudreve_3.7.1_linux_amd64.tar.gz cloudreve root@VM-4-17-ubuntu:/home/ubuntu# ls cloudreve root@VM-4-17-ubuntu:/home/ubuntu# cd cloudreve/ root@VM-4-17-ubuntu:/home/ubuntu/cloudreve# ls cloudreve_3.7.1_linux_amd64.tar.gz root@VM-4-17-ubuntu:/home/ubuntu/cloudreve# tar -zxvf cloudreve_3.7.1_linux_amd64.tar.gz LICENSE README.md README_zh-CN.md cloudreve root@VM-4-17-ubuntu:/home/ubuntu/cloudreve# ls cloudreve cloudreve_3.7.1_linux_amd64.tar.gz LICENSE README.md README_zh-CN.md root@VM-4-17-ubuntu:/home/ubuntu/cloudreve#得到cloudreve主程序,现在我们赋予它执行权限root@VM-4-17-ubuntu:/home/ubuntu/cloudreve# chmod +x ./cloudreve root@VM-4-17-ubuntu:/home/ubuntu/cloudreve# ll total 67756 drwxr-xr-x 2 root root 4096 Apr 23 22:43 ./ drwx------ 8 ubuntu ubuntu 4096 Apr 23 22:36 ../ -rwxr-xr-x 1 501 staff 44763173 Feb 13 19:39 cloudreve* -rw-rw-r-- 1 ubuntu ubuntu 24560355 Feb 13 19:42 cloudreve_3.7.1_linux_amd64.tar.gz -rw-r--r-- 1 501 staff 35146 Feb 4 19:39 LICENSE -rw-r--r-- 1 501 staff 4035 Feb 9 20:45 README.md -rw-r--r-- 1 501 staff 3904 Feb 9 20:45 README_zh-CN.md有了执行权限它就可以运行啦输入./cloudreve即可启动root@VM-4-17-ubuntu:/home/ubuntu/cloudreve# ./cloudreve ___ _ _ / __\ | ___ _ _ __| |_ __ _____ _____ / / | |/ _ \| | | |/ _ | '__/ _ \ \ / / _ \ / /___| | (_) | |_| | (_| | | | __/\ V / __/ \____/|_|\___/ \__,_|\__,_|_| \___| \_/ \___| V3.7.1 Commit #f172220 Pro=false ================================================ [Info] 2023-04-23 22:44:35 Initializing database connection... [Info] 2023-04-23 22:44:35 Start initializing database schema... [Info] 2023-04-23 22:44:35 Admin user name:
[email protected]
[Info] 2023-04-23 22:44:35 Admin password: cqkXTX6k [Info] 2023-04-23 22:44:37 Start executing database script "UpgradeTo3.4.0". [Info] 2023-04-23 22:44:37 Finish initializing database schema. [Info] 2023-04-23 22:44:37 Initialize task queue with WorkerNum = 10 [Info] 2023-04-23 22:44:37 Initialize crontab jobs... [Info] 2023-04-23 22:44:37 Current running mode: Master. [Info] 2023-04-23 22:44:37 Listening to ":5212" 我们可以看到cloudreve的账号信息,一定要保存好,这些信息只有第一次运行才会显示!如果忘了或者不小心关掉了终端 有两个办法可以解决1.最简单的就是删除cloudreve.db文件 重新再运行一次cloudreve就可以啦 (因为cloudreve.db是数据库文件 一旦删除,cloudreve所有的数据都会没有了 请谨慎操作!)2.在cloudreve程序目录下执行./cloudreve --database-script ResetAdminPassword 就会重设初始管理员(即UID为1的用户)的密码,新密码会在命令行日志中输出,请注意保存~.\cloudreve --database-script ResetAdminPasswordCloudreve 默认监听5212端口,如不想使用默认的 编辑cloudreve目录下的“conf.ini”文件修改你想要的端口即可~现在用浏览器打开你服务器的公网IP+5212就可以访问啦~是不是很简单呢有些小伙伴可能发现了,关掉终端或使用Ctrl后cloudreve就无法访问了,那是因为你关闭了cloudreve进程,现在就教大家使用进程守护来保持cloudreve在后台持续运行!# 编辑配置文件 vi /usr/lib/systemd/system/cloudreve.service将PATH_TO_CLOUDREVE 更换为你cloudreve的程序目录[Unit] Description=Cloudreve Documentation=https://docs.cloudreve.org After=network.target Wants=network.target [Service] WorkingDirectory=/PATH_TO_CLOUDREVE ExecStart=/PATH_TO_CLOUDREVE/cloudreve Restart=on-abnormal RestartSec=5s KillMode=mixed StandardOutput=null StandardError=syslog [Install] WantedBy=multi-user.target例如:[Unit] Description=Cloudreve Documentation=https://docs.cloudreve.org After=network.target Wants=network.target [Service] WorkingDirectory=/home/ubuntu/cloudreve ExecStart=/home/ubuntu/cloudreve/cloudreve Restart=on-abnormal RestartSec=5s KillMode=mixed StandardOutput=null StandardError=syslog [Install] WantedBy=multi-user.target编辑完后 按下键盘的Esc :wq 即可保存以下是systemctl常用的命令# 更新配置 systemctl daemon-reload # 启动服务 systemctl start cloudreve # 设置开机启动 systemctl enable cloudreve管理命令# 启动服务 systemctl start cloudreve # 停止服务 systemctl stop cloudreve # 重启服务 systemctl restart cloudreve # 查看状态 systemctl status cloudreve
2023年04月23日
207 阅读
0 评论
29 点赞