适配:Ubuntu + 9541366.com/ + PHP8.3 + WordPress + HTTPS
一、基础环境安装(Nginx + 数据库 + PHP8.3)
sudo apt update
sudo apt install nginx mariadb-server php8.3-fpm php8.3-mysql wget -y
二、创建 WordPress 数据库
sudo mysql -e "
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY '123456';
GRANT ALL ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
"
三、下载安装 WordPress
cd /var/www/html
sudo rm -f index.html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -zxf latest.tar.gz
sudo mv wordpress/* ./
sudo rm -rf wordpress latest.tar.gz
sudo chown -R www-data:www-data /var/www/html
sudo tee /etc/nginx/sites-available/default >/dev/null <<'EOF'
server {
listen 80;
server_name 9541366.com/;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
}
EOF
五、重启服务
sudo nginx -t
sudo systemctl restart nginx
sudo systemctl restart php8.3-fpm
六、配置 HTTPS 安全绿锁
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d 9541366.com/
七、防火墙放行端口
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow ssh
sudo ufw reload
wordpresswpuser123456localhost记住关键一点:云服务器后台安全组一定要放行 80、443 端口,不然配置再好也不安全打不开。