原早only配過Ubuntu server兮WordPress,今伺服器系統是CentOS 7,也來試下。

基礎工課

CentOS默認有mariadb(mysql一款分支)

yum install -y httpd mariadb-server mysql wordpress php php-mysql
systemctl start httpd #service httpd start嘛解使
systemctl enable httpd #開機自啓動
systemctl start mariadb
systemctl enable mariadb

配mysql

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost;
SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");

然後對應修改/usr/share/wordpress/wp-config.php

// ** 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', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

改httpd

修改 /etc/httpd/conf/httpd.conf
比如汝欲將wordpress放佇/wordpress路徑:

AcceptFilter http none
AcceptFilter https none

Alias /wordpress /usr/share/wordpress
<Directory /usr/share/wordpress>
    Options FollowSymLinks
    AllowOverride Limit Options FileInfo
    DirectoryIndex index.php
    Require all granted 
</Directory>
<Directory /usr/share/wordpress/wp-content>
    Options FollowSymLinks
    Require all granted
</Directory>

佇Apache 2.4版本,單

Order allow, deny
Allow from all

兩句袂行(報權限錯誤403),只好加

Require all granted

本站所有文章除特別聲明外,均採用 CC BY-SA 4.0 協議 ,轉載請註明出處!

關係數據理論 前篇
Python異常類型彙整 後篇