MoreRSS

site iconDavid Yin修改

研究SEO 网站优化及网站推广
请复制 RSS 到你的阅读器,或快速订阅到 :

Inoreader Feedly Follow Feedbin Local Reader

David Yin的 RSS 预览

升级到 MovableType 9.3.1

2026-11-04 02:48:08

刚刚看到有新的升级,所以就马上做好更新了。所有的升级都是很简单容易的,只是需要及时的去做,而不要等到网站或者服务器被破了,再来补救,这就麻烦很多了。
最近一段时间,看到有关 php 的几个重大安全补丁,也看到关于群晖的NAS上有出现文件被加密勒索。

这都是拜 AI 所赐。在现在的 AI 狂飙的年代,太多不确定的因素,太多不可预测的事情。

而我一直以来的看法就是,任何不以人为本的技术,都不好,只有给人类带来福祉的,才是更好的。

人不是为技术服务,而应该是技术为人服务。好的技术应该是不已牺牲人的利益为出发点的。

攻击又来了

2026-10-09 05:49:10

上一次受到网络攻击,还是在上一次。

这次还是针对 phpbbchinese.com 支持论坛。

七月被攻击的量

一般而言,这个网站的流量每天以不超过 1GB 为正常,七月的时候是有几天超过了 四五个 GB,最高的一天有9GB。

而今天一早起来,看到web服务器访问504,基本猜测就是又来了。于是查看了 phpBBchinese 的访问日志。

十月受攻击的量
十月受攻击的量

嚯,从十月四日开始,流量已经每天超过16GB了,其实之前每天超过两三个GB都每什么,服务器扛得住,而超过10GB基本上服务器的 php 就开始扛不住了,应该还不是数据库不行,包括 nginx 都是没问题的。攻击者过来的访问都是 GET 请求,访问的公开页面,访问间隔时间极短,每秒几十条的访问请求,大量的IP都是来自 VPN 池,或者数据中心,或者爬虫代理池。

你说他是网络攻击吧,倒还不完全是,因为他没有做 登录尝试,没有 sql 注入,没有异常参数,没有404探测或者敏感路径扫描。

倒是更有可能是一个配置失当的爬虫,肯定不是正经爬虫,因为 UA 没有显示,那就是伪装了,正规的搜索引擎爬虫会声明其搜索引擎的agent,只有那些第三方内容抓取器,某些不正经的 AI 蜘蛛,某些数据采集,还有可能是论坛镜像爬虫。

不管怎样,都造成了服务器负担过重,把服务器上相邻的几个网站也搞得上不去了。

现在,采取了更加粗鲁的封禁手段,针对 AS number 来封。暂时可恢复可用性。还需要时间看看是否能长治久安。

就这样,先报告到这里。

安装 Ubuntu 26.04 (LTS), Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(6)

2026-07-25 04:11:36

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

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

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

外传

网络防火墙

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

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

davidyin@pecan:~$ sudo service nftables status
○ nftables.service - nftables
     Loaded: loaded (/usr/lib/systemd/system/nftables.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:nft(8)
             http://wiki.nftables.org

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

sudo systemctl disable --now ufw
sudo apt remove ufw

当然还需要启用 nftables。安装 fail2ban.

sudo systemctl enable --now nftables

sudo apt install fail2ban

fail2ban 有几个常见命令,如下:

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

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

davidyin@pecan:~$ sudo fail2ban-client status
Status
|- Number of jail:      1
`- Jail list:   sshd
davidyin@pecan:~$ sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 6
|  |- Total failed:     6
|  `- Journal matches:  _SYSTEMD_UNIT=ssh.service + _COMM=sshd
`- Actions
   |- Currently banned: 0
   |- Total banned:     0
   `- Banned IP list:

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

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

另外还有 收件地址等等。

在 Webmin 管理界面,也有 Fail2Ban 的管理模块,使用也是很方便的。我通常就在 webmin 里面做修改。

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

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

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

网络拥塞算法

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

sudo nano /etc/sysctl.d/99-network.conf

添加内容

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

之后应用它

sudo sysctl -p /etc/sysctl.d/99-network.conf

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

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

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

php 8.5 JIT

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

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


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

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

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

用 MicroBench 测试,平均时间从 1.8302 提高到 0.7874

用 bubble.php 测试,时间从 0.08230 提高到 0.0393.

用 X Prober v10.0.1 内置的 Server Benchmark 测试,463,062 提高到了 506,317。

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

安装 Ubuntu 26.04 (LTS), Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(5)

2026-07-25 03:20:05

安装 Ubuntu 26.04 LTS, Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS上。

之前介绍了如何在 DigitalOcean 创建新 VPS。并且完成基本的 Ubuntu 26.04. LTS的系统。然后介绍了如何安装 Webmin 主机控制面板,时区设置和 SSH 的安全设置。再之后说明一下如何用之前的新添加的用户来安装 Nginx Web 服务器和 MairaDB 数据库服务器。以及安装完 php 语言和 SSL 证书的申请。

现在要来介绍一下如何配置 nginx 上的加密站点了。

第五部分

修改 Nginx 配置文件,以满足证书的使用之前,先执行一个命令,来生成一个4096位的 dhparam 文件。

cd ~/ssl
openssl dhparam -out dhparam.pem 4096

需要等待一段时间,这个命令会执行比较长时间。

配置 https 主机

先来确认各个部分的版本信息,下面要用到。


davidyin@walnut:~/ssl$ nginx -v
nginx version: nginx/1.28.3 (Ubuntu)
davidyin@walnut:~/ssl$ openssl version
OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)

配置参数的来源根据 https://configurator.tlsref.org/这个生成器来产生。

我会建议采取 Modern 方式的配置。

主机配置文件做相应的修改, http 网站重定向到 https。 采用 http2,还有就是 HSTS 与载入配置,最后完整的 u26.webexample.win 的配置文件,可以到 gist 查看,仅供参考。

到 SSL Labs 检测 SSL的配置,评分得到 A。

当然也可以到 SSLShopper 去做一下检测,看看证书是否都正确。

安装 Perl-Fastcgi

下面是对我而言很重要的语言支持,因为我有用 MovableType 系统,SEO网站优化 就是用它搭建的。而它是由 perl 语言支持的。

libfcgi-perl 可能已经有了,但下面还是再执行一遍安装,以防缺失。

sudo apt install fcgiwrap spawn-fcgi libfcgi-perl

然后来配置 fcgiwrap 多 worker。

sudo tee /etc/systemd/system/fcgiwrap-multi.service << 'EOF'
[Unit]
Description=FastCGI wrapper (multi-worker)
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/spawn-fcgi -F 4 -s /var/run/fcgiwrap.socket -u www-data -g www-data -- /usr/sbin/fcgiwrap
ExecStopPost=/bin/rm -f /var/run/fcgiwrap.socket
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl disable fcgiwrap
sudo systemctl disable fcgiwrap.socket


sudo systemctl daemon-reload
sudo systemctl enable fcgiwrap-multi
sudo systemctl start fcgiwrap-multi



davidyin@pecan:~$ ps aux | grep fcgiwrap
www-data   11402  0.0  0.2   5116  2808 ?        Ss   00:02   0:00 /usr/sbin/fcgiwrap -f
www-data   11454  0.0  0.2   5116  2416 ?        Ss   00:02   0:00 /usr/sbin/fcgiwrap
www-data   11455  0.0  0.2   5116  2348 ?        Ss   00:02   0:00 /usr/sbin/fcgiwrap
www-data   11456  0.0  0.2   5116  2352 ?        Ss   00:02   0:00 /usr/sbin/fcgiwrap
www-data   11457  0.0  0.2   5116  2420 ?        Ss   00:02   0:00 /usr/sbin/fcgiwrap
davidyin   11838  0.0  0.2   7256  2400 pts/0    S+   00:03   0:00 grep --color=auto fcgiwrap

现在就有 4 个 worker 可以为它工作了。

最后在 Nginx 的配置文件中添加下面这块。

location ~ \.pl|cgi$ {
   fastcgi_pass  unix:/var/run/fcgiwrap.socket;
   fastcgi_index index.pl;
   fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
   include fastcgi_params;
   }

保存配置文件并重启 Nginx 服务。 接下来要测试,是否可以让 perl 文件运行。 新添加一个文件到 /home/davidyin/u26.webexample.win/index.pl 内容如下:

index_pl.txt

在服务器上的文件后缀名必须是 pl,然后给与可执行权限。

chmod 755 index.pl

在浏览器中输入 https://u26.webexample.win/index.pl

如果看到下面的输出内容,那就对了。

看到上面的信息,就可以证明 Perl 可以正常地在网站执行。

到目前为止,已经配置好一个 DigitalOcean 的 VPS,安装好了 Ubuntu 26.04 Lts,Webmin 管理控制面板,以及 Nginx web 服务器,MariaDB 数据库服务器,php8.5-fpm 服务,Perl-Fastcgi 服务,免费的 SSL 证书。配置好了一个测试网站。 之后,需要安装那些由 php 编写的网站程序, Perl 编写的网站程序,都可以安装了。

安装 Ubuntu 26.04 (LTS), Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(4)

2026-07-25 02:20:33

安装 Ubuntu 26.04 LTS, Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS上。

DavidYin 介绍了如何在 DigitalOcean 创建新 VPS。并且完成基本的 Ubuntu 26.04 LTS的系统。然后介绍如何安装 Webmin 主机控制面板,时区设置和 SSH 的安全设置。再之后说明一下如何用之前的新添加的用户来安装 Nginx Web 服务器和 MairaDB 数据库服务器。

现在就是很重要的语言支持部分了。因为我用的最多的就是 php 以及 perl 语言。所以这两部分就是重点了。

第四部分
安装 php8.5-fpm

Ubuntu 26.04 LTS 仓库所包含的是 php8.5.4,目前 php 官方支持的主力版本是 8.4,8.5,而 8.2,8.3 则是在安全补丁支持阶段。所以直接使用 Ubuntu 的就已经是很新的版本了。

sudo apt install php8.5 php8.5-fpm php8.5-cli php8.5-common php8.5-mbstring php8.5-gd php8.5-intl php8.5-xml php8.5-mysql php8.5-zip php8.5-curl

安装完成后,执行 php -v 命令,可以看到版本信息。

davidyin@pecan:~$ php -v
PHP 8.5.4 (cli) (built: Jul 16 2026 18:56:38) (NTS)
Copyright (c) The PHP Group
Built by Ubuntu
Zend Engine v4.5.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.4, Copyright (c), by Zend Technologies

可以确认当前版本为 php 8.5.4. 然后再看一眼,php8.5-frpm 服务是否已经起来。

设置虚拟主机

说明:下面这些都是用来举例说明所用的,在实际使用中请用真实的数据。
IP: 144.126.221.243
Domain: u26.webexample.win
username: davidyin

接下来我要设置一个 vhost,就是一个虚拟主机,我用的域名是 u26.webexample.win,此为举例而已。 到域名服务商的网站,专门设置域名记录的地方,把 u26.webexample.win 的 A 记录指向此 VPS 的 IP 地址,生效可能需要十分钟或更久,为快捷,可以在所操作的Windows hosts 文件添加纪录使之在本地立即可用。 新建一个主机配置文件,u26.conf,如下。

log_format   main '$remote_addr - $remote_user [$time_local]  $status '
    '"$request" $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

server {
    listen       80;
    server_name  u26.webexample.win;
    access_log  /var/log/nginx/host.access.log  main;

    root   /home/davidyin/u26.webexample.win;
    index  index.php index.html index.htm;
    
    location / {
        try_files $uri $uri/ = 404;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.5-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }
}

保存退出,然后执行 sudo nginx -t 命令看看,是否配置文件正确。若正确,就重启 Nginx 服务,使配置生效。

sudo service nginx restart

在/home/davidyin/u26.webexample.win/下新建一个文件 info.php

输入如下内容:

<?php
phpinfo();

回到桌面浏览器中,输入网址 http://u26.webexample.win/info.php,如果看到下面这些内容,就表示 php 安装正确, nginx 也运行正确。

有时候会出现奇怪的问题,找不到文件啊,没有权限啊。这是最好的解决方法,就是重启服务器。有时候是配置未生效。

如果出现问题,或者是页面错误,可以查看这两个日志文件。

/var/log/nginx/host.access.log
/var/log/nginx/error.log

至此,php8.5 已经安装完毕,并且虚拟主机也可以使用 php 语言了。

SSL 证书的签发

如果是商用,或者愿意购买一年期的证书,DavidYin建议到 Gogetssl 购买,这里价格最优,无限重签,不限服务器。目前的证书可以购买5年的,但是实际签发的证书都是半年的,这是现在所有CA 的国际标准,到时重新签发一次,直到购买的年份用完为止。买多年的会便宜一点。

Gogetssl 证书的好处是你买了一个证书给域名 A 用,如果这个域名不用了,还可以签发给域名 B 使用剩下的时间。

免费证书这里我采用 Zerossl 的 SSL 证书。使用了 Neilpang 的 ACME.SH 来安装。每月自动续签。

先安装工具。

curl https://get.acme.sh | sh -s [email protected]

接下来,重新登入SSH,相当于重新载入 BASH 环境,因为上面的安装已经把路径配置到 Bash 中了,并且自动创建了一个 bash 的别名,方便使用,直接输入 acme.sh 命令就可以了。另外还自动创建了一个 cronjob,每天零点自动检测所有的证书,如果快过期,就会自动更新。

验证域名的方式有两种,DNS 和 http,这次我用了 http 方式来验证。

上面一步安装好后,需要先执行一下 source ~/.bashrc , 以让环境参数生效。

davidyin@pecan:~$ acme.sh --issue -d u26.webexample.win --webroot /home/davidyin/u26.webexample.win
[Wed Jul 22 23:17:10 PDT 2026] Using CA: https://acme.zerossl.com/v2/DV90
[Wed Jul 22 23:17:10 PDT 2026] Single domain='u26.webexample.win'
[Wed Jul 22 23:17:15 PDT 2026] Getting webroot for domain='u26.webexample.win'
[Wed Jul 22 23:17:15 PDT 2026] Verifying: u26.webexample.win
[Wed Jul 22 23:17:18 PDT 2026] Processing. The CA is processing your order, please wait. (1/30)
[Wed Jul 22 23:17:22 PDT 2026] Success
[Wed Jul 22 23:17:22 PDT 2026] Verification finished, beginning signing.
[Wed Jul 22 23:17:22 PDT 2026] Let's finalize the order.
[Wed Jul 22 23:17:22 PDT 2026] Le_OrderFinalize='https://acme.zerossl.com/v2/DV90/order/9vGSFUWWbZI18Dgg6xOtHQ/finalize'
[Wed Jul 22 23:17:24 PDT 2026] Order status is 'processing', let's sleep and retry.
[Wed Jul 22 23:17:24 PDT 2026] Sleeping for 15 seconds then retrying
[Wed Jul 22 23:17:40 PDT 2026] Polling order status: https://acme.zerossl.com/v2/DV90/order/9vGSFUWWbZI18Dgg6xOtHQ
[Wed Jul 22 23:17:42 PDT 2026] Downloading cert.
[Wed Jul 22 23:17:42 PDT 2026] Le_LinkCert='https://acme.zerossl.com/v2/DV90/cert/aXnfE7FQTsSqhmxD7aCpVg'
[Wed Jul 22 23:17:44 PDT 2026] Cert success.
-----BEGIN CERTIFICATE-----
MIIDhzCCAyygAwIBAgIQP0RKPW1WFzsDCTAZ2AAP3TAKBggqhkjOPQQDAjBGMQsw
CQYDVQQGEwJBVDEVMBMGA1UEChMMWmVyb1NTTCBHbWJIMSAwHgYDVQQDExdaZXJv
U1NMIEVDQyBEViBTU0wgQ0EgMjAeFw0yNjA3MjMwMDAwMDBaFw0yNjEwMjEyMzU5
NTlaMB0xGzAZBgNVBAMTEnUyNi53ZWJleGFtcGxlLndpbjBZMBMGByqGSM49AgEG
CCqGSM49AwEHA0IABNis5Z7Jdv/8/hMiELxnX0yvXKBxLKk6cwZ2hcbM2+eQQqC8
中间省略
AiEAsXwlwSjlPiMRFS5KuloJBZ7EC6R3+gV61Dvvc8f63ZgCICORhj/RKrXOBP8h
QkztHkWqmXLRoGaPnG6Ujwoz7ppdMB0GA1UdEQQWMBSCEnUyNi53ZWJleGFtcGxl
LndpbjAKBggqhkjOPQQDAgNJADBGAiEA+ZwEXzQApjTiU5aGMOG3R9mTqoezIrtG
lP0ALMIbfZcCIQDcIq2Lg6PpLaOoK8i8by4qAMEWcZf6sTkze5LUXnPssw==
-----END CERTIFICATE-----
[Wed Jul 22 23:17:44 PDT 2026] Your cert is in: /home/davidyin/.acme.sh/u26.webexample.win_ecc/u26.webexample.win.cer
[Wed Jul 22 23:17:44 PDT 2026] Your cert key is in: /home/davidyin/.acme.sh/u26.webexample.win_ecc/u26.webexample.win.key
[Wed Jul 22 23:17:44 PDT 2026] The intermediate CA cert is in: /home/davidyin/.acme.sh/u26.webexample.win_ecc/ca.cer
[Wed Jul 22 23:17:44 PDT 2026] And the full-chain cert is in: /home/davidyin/.acme.sh/u26.webexample.win_ecc/fullchain.cer
[Wed Jul 22 23:17:45 PDT 2026] ARI suggestedWindow: 2026-10-06T23:59:59Z to 2026-10-08T23:59:59Z
[Wed Jul 22 23:17:45 PDT 2026] Next renewal time picked from ARI window: 2026-10-08T06:17:44Z

验证正确,就会自动签发证书,证书会临时先存放在一个工作目录,现在我要指定一个目录存放: /home/davidyin/ssl/。 之后就是安装证书到该目录。

acme.sh --install-cert -d u26.webexample.win \
--key-file       /home/davidyin/ssl/key  \
--fullchain-file /home/davidyin/ssl/cert \
--reloadcmd     "service nginx force-reload" 

就这样,证书也签发好了,也安装到指定位置,接下来会介绍如何在 nginx 的配置文件中,设置证书路径,设置 https,设置重定向,还有 perl-fastcgi等等。

安装 Ubuntu 26.04 (LTS), Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS(3)

2026-07-25 02:01:54

安装 Ubuntu 26.04 (LTS), Webmin, Nginx, MariaDB, PHP8.5-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS

在第一部分,DavidYin 介绍了如何在 DigitalOcean 创建新 VPS。并且完成基本的 Ubuntu 26.04 LTS的系统。
第二部分介绍如何安装 Webmin 主机控制面板,SSH 的安全设置,时区设置和添加新用户 。

下面 DavidYin 要说明一下如何用之前的新添加的用户来安装 Nginx Web 服务器和 MairaDB 数据库服务器。

第三部分

安装 Nginx Web 服务器

先用第二部分时添加的新用户 davidyin 登上 ssh 窗口。

Ubuntu 26.04 LTS server 版目前的 Nginx 还是 Legacy 版本,可以直接安装,当前的最新版本是 1.28.0。

输入命令安装。

davidyin@pecan:~$ sudo apt install nginx
Installing:
  nginx

Installing dependencies:
  nginx-common

Suggested packages:
  fcgiwrap  nginx-doc  ssl-cert

Summary:
  Upgrading: 0, Installing: 2, Removing: 0, Not Upgrading: 0
  Download size: 655 kB
  Space needed: 1860 kB / 21.8 GB available

Continue? [Y/n]
Get:1 http://mirrors.digitalocean.com/ubuntu resolute-updates/main amd64 nginx-common all 1.28.3-2ubuntu1.8 [37.7 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu resolute-updates/main amd64 nginx amd64 1.28.3-2ubuntu1.8 [617 kB]
Fetched 655 kB in 0s (16.0 MB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 159523 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.28.3-2ubuntu1.8_all.deb ...
Unpacking nginx-common (1.28.3-2ubuntu1.8) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.28.3-2ubuntu1.8_amd64.deb ...
Unpacking nginx (1.28.3-2ubuntu1.8) ...
Setting up nginx-common (1.28.3-2ubuntu1.8) ...
Created symlink '/etc/systemd/system/multi-user.target.wants/nginx.service' → '/usr/lib/systemd/system/nginx.service'.
Setting up nginx (1.28.3-2ubuntu1.8) ...
 * Upgrading binary nginx                                                [ OK ]
Processing triggers for man-db (2.13.1-1build1) ...
Processing triggers for ufw (0.36.2-9build1) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

安装完成后,可以看一下安装后的版本以及编译信息

davidyin@pecan:~$ nginx -V
nginx version: nginx/1.28.3 (Ubuntu)
built with OpenSSL 3.5.5 27 Jan 2026
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -Werror=implicit-function-declaration -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/nginx-NbCeiP/nginx-1.28.3=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/nginx-NbCeiP/nginx-1.28.3=/usr/src/nginx-1.28.3-2ubuntu1.8 -fPIC -Wdate-time -D_FORTIFY_SOURCE=3' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,--package-metadata=%7B%22type%22:%22deb%22%2C%22os%22:%22ubuntu%22%2C%22name%22:%22nginx%22%2C%22version%22:%221.28.3-2ubuntu1.8%22%2C%22architecture%22:%22amd64%22%7D -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIC' --override-system=Linux --override-release=3.16.0 --override-machine=x86_64 --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=stderr --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_v3_module --with-http_dav_module --with-http_slice_module --with-threads --build=Ubuntu --with-http_addition_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-mail_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-http_geoip_module=dynamic --with-http_image_filter_module=dynamic --with-http_perl_module=dynamic --with-http_xslt_module=dynamic --with-mail=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic

在浏览器中输入 IP 地址,看看到默认 Nginx 网页是否已经起来。

安装 MariaDB 数据库服务器

它其实就是一个 MySQL 服务器,目前 Ubuntu 26.04 LTS 软件仓库中包含的默认 MariaDB 版本是 11.8.6,此版本是 MariaDB 官方所维护的多个稳定版本之一,在我粗浅的看来,11.4以上的这些个都是稳定版本。

所以也是直接安装就可以了。

输入安装命令。

sudo apt install mariadb-server

安装完成后,就需要修改 MySQL 默认的 root 用户的密码。默认是空密码。

sudo mariadb_secure_installation

添加密码给数据库的 root 用户。命令执行过程中的设置如下:

注意两点,一个是要设置MysQL 服务器的 root 密码,默认是没有密码的。其它的我都选的默认值。很多次看到某些网站被黑,说的都是数据库没有密码保护之类的疏忽。

davidyin@pecan:~$ sudo mariadb-secure-installation

NOTE: MariaDB is secure by default in Debian. Running this script is
      useless at best, and misleading at worst. This script will be
      removed in a future MariaDB release in Debian. Please read
      /usr/share/doc/mariadb-server/README.Debian.gz for details.

Enter root user password or leave blank:

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n]
Enabled successfully (or at least no errors was emitted)!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
SQL executed without errors!
The operation might have been successful, or it might have not done anything.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
SQL executed without errors!
The operation might have been successful, or it might have not done anything.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
SQL executed without errors!
The operation might have been successful, or it might have not done anything.
 - Removing privileges on test database...
SQL executed without errors!
The operation might have been successful, or it might have not done anything.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

然后回到 Webmin 控制面板的地方,左侧: Refresh Modules,在经过一点点时间后, Webmin 系统自动就发现了我已经安装了 MySQL Databse Server。

点击左侧菜单后,就能看到已经认出 MariaDB Database Server 11.8.6

在这里,可以用来添加新的数据库,新的Mysql 用户等等,都是为了以后添加网站,比如 Wordpress 之类的时候使用的。

至此两个服务器的安装已经完成,接下来就要介绍 php8.5-fpm 以及 Perl-fastcgi 的安装了。