使用Apache和WordPress的在家工作項目

以上圖片是我的硬件設置:

盒: Argon One (a very awesome case)
底板: Raspberry pi 4 4G

安裝和設置步驟

安裝Apache服務器

sudo apt-get update
sudo apt-get upgrade
您需要一個網絡服務器,我們將在這裡使用Apache。
sudo apt-get install apache2 -y

安裝 PHP

sudo apt-get install php -y
sudo service apache2 restart

轉到以下路徑,並創建一個內容如下的文件調用index.php:

通過轉到以下地址來檢查您的網頁:
HTTP://localhost/index.php

安裝 mySQL (MariaDB)

sudo apt-get install mariadb-server php-mysql -y

And restart your web server:
sudo service apache2 restart

安裝 WordPress

cd /var/www/html/
sudo rm *
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz
sudo chown -R www-data: .

設置wordPress數據庫

sudo mysql_secure_installation
  • You will be asked Enter current password for root (enter for none): — press Enter.
  • Type in Y and press Enter to Set root password?.
  • Type in a password at the New password: prompt, and press Enter. Important: remember this root password, as you will need it later to set up WordPress.
  • Type in Y to Remove anonymous users.
  • Type in Y to Disallow root login remotely.
  • Type in Y to Remove test database and access to it.
  • Type in Y to Reload privilege tables now.
  • When complete, you will see the message All done! and Thanks for using MariaDB!.

sudo mysql -uroot -p
create database wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO ‘root’@’localhost’ IDENTIFIED BY ‘YOURPASSWORD’;
FLUSH PRIVILEGES;
sudo reboot