1. 程式人生 > >centos7之安裝wordpress

centos7之安裝wordpress

pre -m 文件 his char ML TP 默認 onf

wordpress安裝教程如下:

mysql安裝可以參考我的博客園Centos構建Java環境:https://www.cnblogs.com/youcong/p/9118753.html

1.安裝apache
yum install httpd

systemctl start httpd

2.安裝php

yum install -y php php-mysql
systemctl restart httpd

vim /var/www/html/info.php

<?php phpinfo(); ?>


3.安裝phpmyadmin(補充說明:安裝mysql教程不論是centos還是ubuntu,可以參考我的博客文章)
yum install -y epel-release
yum install -y phpmyadmin

vim /etc/httpd/conf.d/phpMyAdmin.conf

配置文件內容如下:

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
    #   Require ip 127.0.0.1
     #  Require ip ::1
      Require all granted
   </RequireAny>
   </IfModule
> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> <Directory /usr/share/phpMyAdmin/setup/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny
> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule>
</Directory>

重啟httpd服務器
systemctl restart httpd

安裝完phpmyadmin一定要輸入對應的地址進入phpMyAdmin管理平臺
進入該平臺進行用戶添加和數據添加
也可以通過命令行的形式:
例如:
# 登錄數據庫
mysql -u root -p
# 創建數據庫
CREATE DATABASE wordpress;
# 創建數據庫用戶和密碼
CREATE USER wordpressuser@localhost IDENTIFIED BY ‘123456‘;
# 設置wordpressuser訪問wordpress數據庫權限
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘123456‘;
# 刷新數據庫設置
FLUSH PRIVILEGES;
# 退出數據庫
exit

4.安裝wordpress
http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz

解壓後並在當前目錄下執行:sudo rsync -avP ~/wordpress/ /var/www/html/wordpress/

# 切換到wordpress目錄
cd /var/www/html/wordpress
# 復制wp-config.php文件
cp wp-config-sample.php wp-config.php
# 編輯wp-config.php文件
sudo vim wp-config.php

默認內容如下:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME‘, ‘database_name_here‘);
/** MySQL database username */
define(‘DB_USER‘, ‘username_here‘);
/** MySQL database password */
define(‘DB_PASSWORD‘, ‘password_here‘);
/** MySQL hostname */
define(‘DB_HOST‘, ‘localhost‘);

將其修改為:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME‘, ‘wordpress‘);
/** MySQL database username */
define(‘DB_USER‘, ‘wordpress‘);
/** MySQL database password */
define(‘DB_PASSWORD‘, ‘123456‘);
/** MySQL hostname */
define(‘DB_HOST‘, ‘localhost‘);

完成後在瀏覽器輸入地址:www.example.com/wordpress/wp-admin/install.php
按照步驟來,一步一步安裝。

centos7之安裝wordpress