在Debian LAMP上部署WordPress的步骤如下:
安装Apache:
sudo apt update
sudo apt install apache2
安装完成后,Apache服务默认自动运行。
安装MariaDB/MySQL:
sudo apt install mariadb-server
安装完成后,MariaDB服务将会自动启动。运行mysql_secure_installation
命令进行安全配置。
安装PHP:
sudo apt install php libapache2-mod-php php-mysql php-fpm
编辑并查看PHP测试页/var/www/html/phpinfo.php
。
/etc/apache2/sites-available/000-default.conf
,添加以下内容:ServerName yourdomain.com
Redirect permanent / https://yourdomain.com/
/etc/apache2/sites-available/default-ssl.conf
,添加以下内容:SSLCertificateFile /etc/apache2/sites-available/yourdomain.com.crt
SSLCertificateKeyFile /etc/apache2/sites-available/yourdomain.com.key
SSLCertificateChainFile /etc/apache2/sites-available/root_bundle.crt
sudo a2ensite default-ssl
sudo systemctl reload apache2
cd /tmp
wget https://wordpress.org/latest.tar.gz
sudo tar xzvf latest.tar.gz
wp-config-sample.php
为wp-config.php
:cd /tmp/wordpress
sudo mv wp-config-sample.php wp-config.php
/var/www/html
:sudo cp -a /tmp/wordpress/. /var/www/html/wordpress
www-data
):sudo chown -R www-data: /var/www/html/wordpress
http://yourdomain.com/wordpress
,按照提示完成WordPress的安装过程。如果你希望使用Nginx作为Web服务器,可以参考以下步骤:
sudo apt install nginx
/etc/nginx/sites-available/default
文件,添加以下内容:server {
listen 80;
server_name yourdomain.com;
root /var/www/html/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /wordpress/index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
sudo systemctl restart nginx
完成以上步骤后,你的WordPress网站应该已经在Debian LAMP环境中成功部署。