在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環境中成功部署。