lamp架构搭建

lamp架构搭建(yum)

环境:一台主机,centos7.5

 

  1. lamp安装

yum -y install httpd php-fpm php-mysql mariadb-server

  1. 启动php-fpm服务

systemctl start php-fpm

  1. 配置httpd生成配置文件,提示http,php-fpm服务在本地

vim /etc/httpd/conf.d/fcgi.conf

DirectoryIndex index.php

ProxyRequests Off

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1

注意:在HTTPD服务器上必须启用proxy_fcgi_module模块,充当PHP客户端

httpd –M |grep fcgi

cat /etc/httpd/conf.modules.d/00-proxy.conf

  1. 启动服务

systemctl restart httpd mariadb

  1. 编辑测试页面,测试

vim /var/www/html/index.php

<?php

$dsn=’mysql:host=localhost;dbname=mysql’;

$username=’root’;

$passwd=”;

$dbh=new PDO($dsn,$username,$passwd);

var_dump($dbh);

?>

 

 

 

lamp搭建(yum)

环境:三台主机,centos7.5

host1:192.168.67.110   httpd

host2:192.168.67.111   php-fpm php-mysql

host3:192.168.67.112   mariadb-server

 

  1. 在host1上安装httpd;host2上安装php-fpm;host3上安装mariadb-server

host1: yum -y install httpd

host2:yum -y install php-fpm php-mysql

host3: yum -y install mariadb-server

 

  1. host3:启动mariadb,创建用户,允许远程连接

systemctl start mariadb

MariaDB [(none)]> grant all on *.* to test@’192.168.67.%’ identified by ‘aa12345’;

  1. host2:编辑配置文件/etc/php-fpm.d/www.conf,并启动服务

图片1

systemctl start php-fpm

 

  1. host1:生成配置文件,重启

vim /etc/httpd/conf.d/fcgi.conf

图片2

systemctl restart httpd

 

  1. host2:根据host1配置,创建放置.php后缀文件目录

mkdir /data/www

 

  1. host2:在网页目录下创建测试文件

vim /data/www/index.php

图片3

 

 

 

基于lamp(yum)搭建论坛

安装环境:2台主机,系统centos7.5

安装包: Discuz_X3.2_SC_UTF8.zip

host1:192.168.67.110   httpd php-fpm php-mysql

host2:192.168.67.111   mariadb-server

 

  1. host1:安装httpd,php-fpm php-mysql; host2:安装mariadb-server

yum -y install httpd php-fpm php-mysql

yum -y install mariadb-server

 

  1. host2:启动mariadb服务,并且创建远程连接用户

systemctl start mariadb

MariaDB [(none)]> grant all on *.* to test@’192.168.67.%’ identified by ‘aa12345’;

 

  1. host1:生成配置文件,重启

vim /etc/httpd/conf.d/fcgi.conf

DirectoryIndex index.php

ProxyRequests Off

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1

 

systemctl restart httpd

systemctl restart php-fpm

 

  1. 解压安装包2_SC_UTF8.zip,并把页面文件放置到/var/www/html/下

unzip Discuz_X3.2_SC_UTF8.zip

mv upload/* /var/www/html/

 

  1. 授权apache用户使其对/var/www/html/目录有写权限

setfacl -R -m u:apache:rwx /var/www/html/

 

  1. 在客户端配置安装

192.168.67.110/install/index.php

图片4

 

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/101652

发表评论

登录后才能评论

This site uses Akismet to reduce spam. Learn how your comment data is processed.

联系我们

400-080-6560

在线咨询

工作时间:周一至周五,9:30-18:30,节假日同时也值班

QR code