LNMP (a)
A, LNMP Architecture Overview
1, LAMP architecture composed of dynamic websites
lamp stands linux + apache + mysql + php
2, LAMP acting portion is composed of
Means in the context of the lamp, the main function of apache / mysql and php are as follows:
apache主要实现如下功能:
第一: 处理http的请求,构建响应报文等自身服务;
第二: 配置Apache支持PHP程序的响应(通过PHP模块或fpm);
第三: 配置Apache具体处理PHP程序的方法,如通过反向代理PHP程序交给fcgi处理;
PHP主要实现如下功能:
第一: 提供Apache的访问接口,即CGI或Fast CGI(FPM);
第二: 提供PHP程序的解释器;
第三: 提供mysql/mairadb数据库的连接函数的基本环境;
mysql主要实现如下功能:
第一: 提供PHP程序对数据的存储;
第二:提供PHP程序对数据的读取(通常情况下从性能的角度考虑,尽量实现数据库的读写分离)。
由此可知,要实现LAMP在配置每一个服务时,安装功能需求进行配置,即可实现在LAMP的架构,
当然Apache,musql和PHP服务都可配置为独立服务,安装在不同服务器之上。
Two, RPM packages built LAMP architecture
Centos yum install rpm package to a local village
1, modify the yum configuration file
sed -i "s/keepcache=0/keepcache=1/g" /etc/yum.conf
2, clearing the cache yum
yum clean all
yum makecache
3, yum install
yum install mysql mysql-server php php-mysql php-fpm httpd -y
或
yum install mysql* php* httpd* -y
4, download the rpm package to a local
cd /var/cache/yum/x86_64/6/base/packages
sz *
5, open the mysql service
/etc/init.d/mysqld start
在刚安装好的mysql默认进入是没有密码的直接在终端中输入:mysql 就可以登录,但是为了保证其安全性,可以修改其密码
#登录数据库
mysql
mysql -u root -h 10.0.0.21 -p '123456'
#退出数据库
mysql> \q
mysql> exit
#mysql数据库登录密码
/usr/bin/mysqladmin -u root password '123456'
Third, configure apache support php
1、
vim /etc/httpd/conf/httpd.conf
在DirectoryIndex index.html后添加加index.php #支持php
添加AddType application/x-httpd-php .php #支持php应用
2. Creating PHP test pages
#创建php测试页
vim /var/www/html/index.php
内容:
<?php
phpinfo();
?>
3, PHP restart Apache test page
/etc/init.d/httpd restart
访问
http://10.0.0.21/
Fourth, the installation configuration Discuz forum
1, upload Discuz the upload folder of files to the root directory of the site
Discuz_X3.3_SC_UTF8.zip
#将论坛的安装包上传到服务器并解压
#安装解压工具:
yum -y install unzip
解压
unzip Discuz_X3.3_SC_UTF8.zip
rm -f /var/www/html/*
cp -a upload/* /var/www/html
cd /var/www/html
#增加可写权限
chmod 777 -R *
2, browser access to install, accept the license terms
3, configure php
#编辑php配置文件
vim /etc/php.ini
#修改
229 short_open_tag = On
#重启httpd
service httpd restart
4 , connect to the database , select the site content stored in the database
#mysql数据库的操作
创建数据库
mysqladmin create wg
或者
[root@ c6m01 ~]# mysql -uroot -hlocalhost -p'123456'
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
mysql> create database wg;
退出数据库
mysql> quit
mysql> \q
mysql> exit
修改数据库root账户密码
mysqladmin password 123456
5 , set the background administrator and password
6, visit the forum address.
http://10.0.0.21