2017年6月7日 星期三

WordPress On CentOS6.8

環境:
CentOS6.8 64bit
Apache 2.2
MYSQL5.6
PHP5.6
PHP-FPM5.6
WordPress



🔻安裝epel軟體源 

yum install epel-release -y


🔻系統安全性更新 

yum update glibc bash openssl sudo -y 


🔻安裝php5.6 // percona mysql 軟體源

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

rpm -Uvh http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm


🔻安裝apache2.2 // php5.6 // php-fpm5.6

yum install php56w.x86_64 php56w-devel php56w-xml.x86_64 php56w-gd.x86_64  php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-opcache.x86_64 php56w-fpm -y 


🔻安裝percona mysql 5.6

 yum install Percona-Server-server-56.x86_64 Percona-Server-devel-56.x86_64 Percona-Server-client-56.x86_64 Percona-Server-shared-56.x86_64 -y 


🔻安裝apache mod_fastcgi

yum install mod_fcgid.x86_64 -y

🔻修改php.ini

date.timezone = Asia/Taipei

🔻修改/etc/php-fpm.d/www.conf 

註解
#listen = 127.0.0.1:9000

新增
listen = /var/run/php56-fpm.sock

啟動
/etc/init.d/php-fpm start

開機啟動
chkconfig php-fpm on

🔻在 /etc/httpd/conf.d/fcgid.conf  新增php-fpm設定

新增
<IfModule mod_fastcgi.c>
  ScriptAlias /fcgi-bin/ /usr/bin/
    AddType application/x-httpd-php .php
    AddHandler php-fastcgi .php
    Action php-fastcgi /fcgi-bin/php-cgi
    FastCgiExternalServer /usr/bin/php-cgi -socket /var/run/php56-fpm.sock
</IfModule>


啟動
/etc/init.d/httpd start

開機啟動
chckocnfig httpd on 


🔻使用php info測試服務是否正常

cd /var/www/html/

ehco "<?php
phpinfo();
?>
" > test.php

訪問 http://yourip/test.php

看是否能夠訪問到頁面

🔻安裝wordpress

1. 設定mysql

啟動
/etc/init.d/mysql start

開機啟動
chkconfig mysql on 


2. 設定wordpress資料庫和權限

mysql -uroot -p 

CREATE USER wordpressuser@localhost;

SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';


3. 設定wordpress

 yum install wget
  
wget http://wordpress.org/latest.tar.gz

mkdir /wordpress

tar zxvf latest.tar.gz -C /tmp

cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php

cp -rf /tmp/wordpress/* /wordpress

將資料庫帳密填入wp-config.php 

訪問http://example.com/wp-admin/install.php即可開始配置wordpress



🔻Apache SSL配置


🔻Apache , PHP 安全性配置


.........待續


參考網址:
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-6--2
https://serverfault.com/questions/663294/how-to-configure-php-fpm-for-php-5-6-and-apache-2-2





沒有留言:

張貼留言