Linux下wget下载并覆盖原文件
如下命令:
wget -O /指定目录/xu.txt https://www.80tm.com/xu.txt
注:如果不指定目录,就会下载到当前目录,效果如下。
wget -O https://www.80tm.com/xu.txt
Linux下wget下载并覆盖原文件
如下命令:
wget -O /指定目录/xu.txt https://www.80tm.com/xu.txt
注:如果不指定目录,就会下载到当前目录,效果如下。
wget -O https://www.80tm.com/xu.txt
传说中的优势:TCPA启用后,小文件比BBR能提升40%以上,大文件比BBR能提升5%~10%。
TCPA的优势在于小文件的性能提升,程序也默认仅加速网站端口(80/443/8080),所以更适用于建站场景。
缺陷:内核版本太低,并且系统要求严格
注意:腾讯官方已经删除了原贴,因为GPL协议限制,内核级别的软件,不开源就不要分发(公共发表),只能自个儿企业内部玩。
警示:这是内核修改,使用风险要自己评估
环境要求:
centos7
/boot分区≥500M(太小会安装失败)
注意:腾讯官方已经删除了原贴,但是目前还可以使用。
部署流程:
安装必要依赖:
yum -y install net-tools
更换系统内核
[root@vultr ~]# wget http://down.08mb.com/tcp_opz/tcpa/kernel-3.10.0-693.5.2.tcpa06.tl2.x86_64.rpm
[root@vultr ~]# rpm -ivh kernel-3.10.0-693.5.2.tcpa06.tl2.x86_64.rpm --force
Preparing... ################################# [100%]
Updating / installing...
1:kernel-3.10.0-693.5.2.tcpa06.tl2 ################################# [100%]
Install kernel
Set Grub default to "3.10.0-693.5.2.tcpa06.tl2" Done.
重启操作系统
reboot
下载主程序:
wget http://down.08mb.com/tcp_opz/tcpa/tcpa_packets_180619_1151.tar.gz
开始安装:
tar xf tcpa_packets_180619_1151.tar.gz
cd tcpa_packets
sh install.sh
TCPA(默认只加速80,443,8080这3个端口),如需新增加速端口:
vim /usr/local/storage/tcpav2/start.sh
第46行后添加:
$BINDIR/$CTLAPP access add tip $ip tport 自定义端口
启动TCPA拥塞算法:
cd /usr/local/storage/tcpav2
sh start.sh
查看是否开启成功
[root@vultr tcpav2]# lsmod|grep tcpa
tcpa_engine 224249 0
卸载方法:
cd /usr/local/storage/tcpav2
sh uninstall.sh
1、IIS的Wordpress伪静态规则配置
创建httpd.ini 文件,将以下内容粘贴到文件中,然后上传到WordPress站点的根目录即可。
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /tag/(.*) /index\.php\?tag=$1
RewriteRule /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]
2、Nginx的Wordpress伪静态规则配置
在Nginx的虚拟主机配置文件中,在 server { } 大括号里面,加入以下代码:
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
保存,重启 Nginx 即可。
3、Apache的Wordpress伪静态规则配置
编辑httpd.conf(在那里? APACHE目录的CONF目录里面)
查找
Options FollowSymLinks
AllowOverride None
改为
Options FollowSymLinks
AllowOverride All
如果已经开启了htaccess,则直接进入下一步:
新建一个 htaccess.txt 文件,添加下面的代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
然后上传到 WordPress 站点的根目录,重命名为 .htaccess 即可
运行环境:Nginx 1.15 + PHP-7.0 + MySQL 5.6
优化:
1、安装,并开启BBR或者BBRplus版(低带宽和低内存不推荐使用锐速)
链接:开启BBR
作用:谷歌公司开发BBR对线路流畅程度,有较大的保障。
2、网站开启TLS1.3
必须:Nginx 1.15
网站的配置文件加上TLSv1.3相关配置,如下(不要再使用TLSv1):
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5;
作用:开启TLS1.3可以有效减少握手次数,略微缩短访问时间,修改完网站配置需要重启Nigx。
3、安装三个PHP扩展:opcache、memcached、redis;
特别是redis一定要安装上,提速非常明显。
安装方法……请百度
作用:
opcache、memcached都是内容缓存,简单易懂。
redis相当于把数据库放入内存中,不需要每次都到硬盘访问数据,提速非常明显。
注意:WordPress在大陆使用,需要先替换谷歌字体和部分css、js等,因为谷歌屏蔽了,必须替换,否则载入不了。
1、新建工作表。
2、右击新建的工作表名称,点击“查看代码(V)”
3、复制输入如下代码:
|
4、点击F5,运行即可。
BaiduPCS-Go是一位大佬用GO语言写的脚本,可以一键上传、下载、离线下载百度网盘的内容(优点:能突破带宽,批量下载)。
Github地址:https://github.com/iikira/BaiduPCS-Go
地址1: https://www.baiduwp.com
地址2: https://baiduwangpan.com
运行一下命令:
wget https://github.com/iikira/BaiduPCS-Go/releases/download/v3.5.3/BaiduPCS-Go-v3.5.3-linux-amd64.zip
#自行去Github寻找最新版本和适合的架构
unzip BaiduPCS-Go-v3.5.3-linux-amd64.zip
#错误提示可以:sudo apt-get update
chmod +x BaiduPCS-Go-v3.5.3-linux-amd64
cd BaiduPCS-Go-v3.5.3-linux-amd64
1、绑定账户
./BaiduPCS-Go login
#普通登录绑定
./BaiduPCS-Go login -bduss=<BDUSS>
#BDUSS建议绑定,不知道怎么获取BDUSS请百度
2、设置需要下载到的目录
./BaiduPCS-Go config set -savedir /home/Download
#下载文件的储存目录
3、列出百度网盘中的文件
./BaiduPCS-Go ls
5、设置最大并发量
./BaiduPCS-Go config set -max_parallel 150
4、下载百度云目录
./BaiduPCS-Go cd /
./BaiduPCS-Go d 我的软件
5、解决错误代码4, No permission to do this operation
./BaiduPCS-Go config set -appid 309847
Linux 发行版在内核版本 4.9 及以上版本中
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sudo sysctl -p
查看BBR是否安装启动:
sysctl net.ipv4.tcp_congestion_control
lsmod | grep bbr
如果结果显示有tcp_bbr模块,则表示BBR已加载到内核中。
#支持系统:CentOS 6+、Debian 8+、Debian 10、buntu 14+、Ubuntu 16+
wget --no-check-certificate -q -O tcp.sh "https://github.com/cx9208/Linux-NetSpeed/raw/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
BBR plus内核升级版
不卸载内核版本
wget -N --no-check-certificate "https://github.000060000.xyz/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
或
wget -N "https://github.000060000.xyz/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
安装完内核之后,reboot 重启 ./tcp.sh 进入管理脚本,开启加速