原早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 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
|
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
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),只好加