LAMP部署(php模塊化)

一、部署計劃

httpd服務在服務器A
    php是httpd中的一個模塊,不是一個獨立服務
mysql服務在服務器B

二、安裝相應軟件包並開啓服務

1.安裝

服務器A:
    yum  -y install httpd php  php-mysql
    systemctl start httpd
服務器B:
    centos7:yum -y install mariadb-server
    centos6:yum -y install mysql-server

2.開啓服務

服務器A:
    centos6:service httpd start
    centos7:systemctl start httpd
服務器B:
    centos6:service mysqld  start
    centos7: systemctl start mariadb  

3.數據庫安全腳本

服務器B:
     mysql_secure_installation 

4.修改httpd配置文件

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
vim /etc/httpd/conf/httpd.conf 
        DirectoryIndex index.html index.php  index.html.var

service httpd restart或systemctl restart httpd

三、安裝PHP應用——phpMyadmin

1.源碼

    phpMyAdmin-4.0.10.20-all-languages.zip
    鏈接:http://pan.baidu.com/s/1hrQa3PE 密碼:xal6

2.解壓安裝到httpd站點目錄下

cd /var/www/html/
unzip phpMyAdmin-4.0.10.20-all-languages.zip 

3.不用make,直接就是php程序

注意

#先安裝組件
    yum install php-mbstring

4.修改配置文件使其可以管理非本機的mysql數據庫

服務器A
    cd /var/www/html/phpMyAdmin
    cp config.sample.inc.php   config.inc.php
    vim config.inc.php
        $cfg['Servers'][$i]['host'] = '172.17.16.173';
            此處172.17.16.173代表mysql數據庫服務器的IP地址

    service restart httpd          

但是還必須在要創建一個可以遠程連接數據庫的賬戶

服務器B:
    grant all privileges on *.* to root@'%' identified by "密碼";

四、安裝PHP應用——wordpress

1.創建屬於wordpress的數據庫和數據庫管理用戶

在phpMyadmin頁面中創建
或使用mysql命令創建
    create database wordpress
    GRANT all privileges on wordpress.* TO 'wordpress_user'@'%'IDENTIFIED BY 'passwd‘;

2.源碼

wordpress-4.8.1-zh_CN.tar.gz
密碼:iwxl

3.解壓到httpd站點目錄下

 tar xf wordpress-4.8.1-zh_CN.tar.gz 

4.修改配置文件

cd wordpress/
cp wp-config-sample.php   wp-config.php 
vim wp-config.php  
#修改下列幾行
/** WordPress數據庫的名稱 */
define('DB_NAME', 'wordpress');

/** MySQL數據庫用戶名 */
define('DB_USER', 'wordpress_user');

/** MySQL數據庫密碼 */
define('DB_PASSWORD', 'password');

/** MySQL主機 */
define('DB_HOST', '172.17.16.173');
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章