centos7 搭建WordPress詳細步驟
#安裝LAMP
yum install httpd mariadb mariadb-server php php-mysql -y
#新建測試php頁
echo "<? phpinfo (); ?>" > /var/www/html/phpinfo.php
#啟動httpd
systemctl restart httpd
#重啟防火墻,並允許http通過
systemctl restart firewalld
firewall-cmd --permanent --add-service=http
#啟動數據庫,並設置密碼,
systemctl restart mariadb
mysql -u root -p
set password = password(‘123456‘);
創建數據庫
MariaDB [(none)]> create database wordpress;
創建用戶
MariaDB [(none)]> create user ‘laotang6‘@‘localhost‘ identified by ‘123456‘;
用戶授權
MariaDB [(none)]> grant all on wordpress.* to ‘laotang6‘@‘localhost‘;
exit
#安裝WordPress中文版
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
#解壓
tar xzvf wordpress-4.9.4-zh_CN.tar.gz
cd wordpress/
mv * /var/www/html/
cd /var/www/html/
chmod 777 -R wp-content/
#啟動httpd
systemctl restart httpd
遊覽器訪問:
填入我們前面創建的數據庫跟數據庫用戶和密碼。
出現這個情況,我們在/var/www/html/手動創建文件就可以了
vim /var/www/html/wp-config.php
將上圖提示的文件內容復制進去
如上,WordPress基礎已經配置完成了
接著配置FTP,讓WordPress能夠下載跟上傳文件
yum install vsftpd -y
systemctl restart vsftpd
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
新建用戶,跟密碼
useradd laotang6
passwd laotang6
媒體庫默認最大文件為2M,
我們這裏更改為50M:
vim /etc/php.ini
upload_max_filesize = 50M
post_max_size = 50M
systemctl restart httpd
首頁:
centos7 搭建WordPress詳細步驟