CentOS安裝WordPress

 

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

基礎工課

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

1
2
3
4
5
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

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

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

1
2
3
4
5
6
7
8
9
// ** 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路徑:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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版本,單

1
2
Order allow, deny
Allow from all

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

1
Require all granted

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