标签:LAMP
CentOS 7, lamp (module);要求:(1) 三者分离于两台主机;
(2) 一个虚拟主机用于提供phpMyAdmin;另一个虚拟主机用于提供wordpress;
(3) xcache
(4) 为phpMyAdmin提供https虚拟主机;
主机1:192.168.2.110
apache+php
主机2:192.168.2.111
mariadb
一、在主机1上安装httpd、php、php-mysql
[root@localhost ~]# yum install -y httpd php php-mysql
二、创建网站路径目录
[root@localhost ~]# mkdir -pv /www/htdocs/web{1,2}
三、在httpd上配置虚拟主机
[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf <VirtualHost 192.168.2.110:80> ServerName pma.mylinuxops.com DocumentRoot /www/htdocs/web1 <Directory /www/htdocs/web1> Options none AllowOverRide none Require all granted </Directory> </VirtualHost> <VirtualHost 192.168.2.110:80> ServerName wp.mylinuxops.com DocumentRoot /www/htdocs/web2 <Directory /www/htdocs/web2> Options none AllowOverRide none Require all granted </Directory> <VirtualHost>
四、检查配置文件是否有语法错误,启动httpd
[root@localhost ~]# httpd -t [root@localhost ~]# systemctl start httpd
五、在主机2上安装mariadb,启动mariadb,创建用于pma及wp的用户账号
[root@localhost ~]# yum install -y mariadb-server [root@localhost ~]# systemctl start mariadb [root@localhost ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.56-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE USER 'pmauser'@'192.168.2.110' IDENTIFIED BY 'magedu'; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> CREATE USER 'wpuser'@'192.168.2.110' IDENTIFIED BY 'magedu'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye
六、测试LAMP链接
[root@localhost ~]# vim /www/htdocs/web1/index.php <?php $link = $msyql_connect('192.168.2.111','pmauser','magedu'); if ($link) echo "success"; else else "failure"; mysql_close(); phpinfo(); ?>
七、安装phpMyAdmin
(1)解压phpMyAdmin,并将解压出的文件复制到网站根目录下
[root@localhost ~]# unzip phpMyAdmin-4.0.10.20-all-languages.zip [root@localhost ~]# cp -a phpMyAdmin-4.0.10.20-all-languages /www/htdocs/web1 [root@localhost web1]# ln -sv /www/htdocs/web1/phpMyAdmin-4.0.10.20-all-languages /www/htdocs/web1/pma "/www/htdocs/web1/pma" -> "/www/htdocs/web1/phpMyAdmin-4.0.10.20-all-languages"
(2)修改配置文件
[root@localhost web1]# cd pma [root@localhost pma]# cp config.sample.inc.php config.inc.php [root@localhost pma]# vim config.inc.php cfg['Servers'][$i]['host'] = '192.168.2.111'; 将主机指向mysql服务器
(3)安装php-mbstring
[root@localhost web1]# yum install -y php-mbstring
(4)重启httpd服务
[root@localhost web1]# systemctl restart httpd
(5)测试
八、安装wordpress
标签:LAMP
原文地址:http://blog.51cto.com/11886307/2103370