跳至内容
- 更新系统软件包和依赖项:
sudo apt update
sudo apt upgrade
sudo apt install build-essential curl wget git
- 安装Nginx:
sudo apt install nginx
- 安装MySQL:
sudo apt install mysql-server
- 安装PHP7.4和PHP8.0以及相关基础扩展:需要其他的扩展模块可自行添加
sudo apt install php7.4 php7.4-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip
sudo apt install php8.0 php8.0-fpm php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-zip
- 安装Redis:
sudo apt install redis-server
- 安装acme.sh:
sudo su
git clone https://github.com/acmesh-official/acme.sh.git
cd acme.sh
./acme.sh --install --auto-upgrade
exit
- 配置acme.sh自动续签:
sudo su
crontab -e
在末尾添加以下内容:
0 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
- 启动服务并设置开机自启动:
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start mysql
sudo systemctl enable mysql
sudo systemctl start php7.4-fpm
sudo systemctl enable php7.4-fpm
sudo systemctl start php8.0-fpm
sudo systemctl enable php8.0-fpm
sudo systemctl start redis-server
sudo systemctl enable redis-server