LAMP部署(php模块化)

来源:互联网 发布:mac怎么播放rar 编辑:程序博客网 时间:2024/06/06 01:27

一、部署计划

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.bakvim /etc/httpd/conf/httpd.conf         DirectoryIndex index.html index.php  index.html.varservice 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');