最近一次安装时各组件的版本是:
Ubuntu:24.04.1/Nginx:1.24.0/PHP:8.3.16/MaraiDB: 10.11.8/Wordpress:6.7.1/Redis:7.0.15
更新日期 2/4/2025
8/6/20228/30/2020
1.创建基于Ubuntu的新VPS
以Windows Azure为例:
- OS通常选择熟悉的Linux最新稳定版,我这里选择Ubuntu Server 24.04 LTS
- Location:East Asia (附:Azure 测速网站 http://www.azurespeed.com/ )
- 固定公网IP
- 网络防火墙打开Inbound Security Rules 端口 TCP22 , TCP80 & TCP 443
2. 通过SSH登陆VM,安装最新内核并开启BBR(可选)
- BBR已包含在新版本的Ubuntu内核里,下面的命令将其开启
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
使用秋大一键安装脚本 https://teddysun.com/489.html- 开启BBR参考这篇文章:https://www.mf8.biz/ubuntu-20-04-bbr/
3.安装LEMP后安装Wordpress
最近一次安装过程参考的是下面这篇文章:
- https://nuno-sarmento.com/install-wordpress-on-ubuntu-23-10/
https://www.linuxcapable.com/install-wordpress-with-nginx-mariadb-php-on-ubuntu-22-04-lts/https://www.nuno-sarmento.com/install-wordpress-on-ubuntu-20-04/https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-16-04
基本就是follow链接里的步骤。几点例外:
- 链接里在Ubuntu23.10上的操作和在24.04上的操作没有区别
- 我习惯用Vi 而不是 Nano
- 文章中的“Step 7: Install WordPress”作者没有记录更改目录权限的步骤
sudo chown -R www-data:www-data /var/www/wordpress
- 文章中的“Step 8: Configure Nginx for WordPress”记得还要修改对上传文件大小的限制
client_max_body_size 100M;
- 我还额外安装了几个php部件
sudo apt install php8.3-imagick php8.3-intl
- 我这次选择了使用Redis而不是Memcached。如果更喜欢memcached,可以通过下面的命令安装
sudo apt install memcached php8.3-memcached
sudo systemctl enable memcached
sudo systemctl start memcached
其他步骤follow链接教程,基本无变化
到此我就在Window Azure的平台上创建了一个干净的,相对安全的wordpress环境。其实我同时也在wordpress开启了两步验证登录,并优化了网站性能,具体过程见链接文章。