惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

SEO 网站优化及网站推广

连续三次系统升级,直到 v9.0.5 更一个新 网络爬虫,网络蜘蛛的问题 迁移到新的服务器 升级到 MovableType 8.4.2 升级到 MovableType 8.4.0 安装 Ubuntu 24.04 (LTS), Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(4) 安装 Ubuntu 24.04 (LTS), Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(1) 安装 Ubuntu 24.04 (LTS), Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(5) 审计你的网页的各项指标 安装 Ubuntu 24.04 (LTS), Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(3) 安装 Ubuntu 24.04 (LTS), Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(2) 最近在学习研究的几个东西 十月更新
安装 Ubuntu 24.04 (LTS), Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(6)
David Yin · 2024-10-16 · via SEO 网站优化及网站推广

在介绍了如何安装 Ubuntu 24.04 LTS, Webmin, Nginx, MariaDB, PHP8.1-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS上后,有些补充内容。

比如 acme.sh 现在安装的 SSL 证书,默认已经是 ecc 证书了,就是 ecc-256 (prime256v1, "ECDSA P-256")。

然而还有一些需要说明的情况就放在了下面。

外传

网络防火墙

实际使用上,现在我已经很少再用 TCP Wrap 来作安全防护,而是使用了 nftables 防火墙,配合 fail2ban 来组合配合。

Ubuntu 24.04.1 已经默认安装了 nftables 了,如果没有的话,就是用下面的来安装。

sudo apt install nftables

而 Ubuntu 24.04 默认是安装使用了 UFW,作为 nftables 的前端。这里我不打算使用。就需要卸掉。

sudo systemctl disable --now ufw
sudo apt remove ufw

当然还需要启用 nftables。

sudo systemctl enable --now nftables
sudo apt install fail2ban

有几个常见命令

sudo systemctl enable fail2ban
sudo systemctl start fail2ban
sudo fail2ban-client version

返回 1.0.2,这是版本号。还有两个命令可以看 fail2ban 的状态,Ban了那些服务,哪些 IP 地址。

davidyin@walnut:~$ sudo fail2ban-client status
Status
|- Number of jail:      1
`- Jail list:   sshd
davidyin@walnut:~$ sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 1
|  |- Total failed:     10
|  `- File list:        /var/log/auth.log
`- Actions
   |- Currently banned: 1
   |- Total banned:     1
   `- Banned IP list:   183.81.169.238

fail2ban 的配置文件,最好是修改 /etc/fail2ban/jail.local 这个是本机文件,以后升级系统,升级 fail2ban 也不会改变该文件。

有些参数需要设置在 jail.local 里面。比如下面,在 ignoreip 这里填入自己的 ip 地址,这样就不会不小心把自己给关在外面了。

另外还有 收件地址等等。

[sshd]
enabled = true
filter = sshd
backend = polling
action = %(action_mwl)s
ignoreip    = 127.0.0.1 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
bantime = 24h
findtime = 10m
maxretry = 5
mta = sendmail
destemail = email@address
sendername = Fail2Ban

在 Webmin 管理界面,也有 Fail2Ban 的管理模块,使用也是很方便的。

walnut-fail2ban.jpg大概启用 fail2ban 三个小时之后,看一眼封掉多少 IP。

walnut-fail2ban-ip.jpg在大约二十个小时之后,大约被封禁掉78个 IP 地址。大多是那些从各个机房过来扫描的。

walnut-fail2ban-20hours.jpg在开机大约七天后,再次查看了 Fail2Ban 的记录,在 SSH服务上,各种登录尝试失败后的情况,被封禁的 IP 数量达到 831 次。当前还有 95 个 IP 地址。

Screenshot 2024-10-15 212030.jpg

网络拥塞算法

这个对于网络传输很重要。好的这是 Google 搞出来的东西,BBR。

 sudo nano /etc/sysctl.conf

在文件最后加上下面两行

net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

再执行下面命令使之生效:

sudo sysctl -p

有两条命令可以用来查看情况,下面第一条是看有哪些可用的拥塞算法,第二条是看当前生效的是哪一种拥塞算法。

davidyin@walnut:~$ sudo sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
davidyin@walnut:~$ sudo sysctl -n net.ipv4.tcp_congestion_control
bbr

对于使用 php 重度用户,其实还需要开启 jit。

php 8.3 JIT

编辑 /etc/php/8.3/fpm/conf.d/10-opcache.ini

修改内容,增加下面这三项主要的修改。

opcache.enable_cli=1
 opcache.jit_buffer_size=64M
opcache.jit=tracing

修改完成后,重启 php8.3-fpm 服务,用我常用的一些 php 性能测试 script,比较修改前后的测试结果。可以大体得出一个结论,速度快了。

用 bench.php 测试,平均时间从 0.395s 提高到了 0.101秒。

用 bubble.php 测试,时间从 0.0703 提高到 0.0257.

用 X Prober v8.19 内置的 Server Benchmark 测试,387,479 提高到了 425,905。

这种性能提高不是看数字,而是能实际感受得到的。