文章目录
- 一:LNMP架构解读
- 二:MySQL安装配置
- 2.1 为了与Nginx、PHP环境保持一致,此处选择采用源代码编译的方式安装MySQL组件
- 2.2 MySQL部署的方法
- 2.3 安装mysql数据库
- 2.3.1 安装编译包
- 2.3.2 创建mysql用户,使其无法正常登陆
- 2.3.3 解压源码包到/opt下
- 2.3.4 cmake配置属性,make编译安装
- 2.3.5 设置mysql的软件目录的属主属组为mysql:mysql
- 2.3.6 编辑配置文件/etc/my.cnf,里面的内容全部删除,然后换成以下内容
- 2.3.7 设置配置文件/etc/my.cnf的属主属组为mysql,将mysql的脚本目录加入到环境变量内,使mysql的脚本可以被系统识别
- 2.3.8 初始化数据库,使用mysqld进行初始化
- 2.3.9 将mysql的服务脚本从软件内复制到/lib/systemd/system中
- 2.3.10 开启服务,设置mysqld为开机自启动
- 2.3.11 设置mysql服务的管理员密码
- 2.3.12 登录数据库
- 三:PHP解析环境
- 四:PHP解析环境的安装
- 五:配置Nginx支持PHP环境
- 六:常见的PHP开源产品介绍
- 总结
前言:
nginx用来做反向代理的情况比较多
- LNMP架构的部署
- LNMP应用部署
一:LNMP架构解读
1.1 LNMP平台就是Linux、Nginx、MySQL、PHP的组合架构,需要Linux服务器、MySQL数据库、PHP解析环境
1.2 本案例在单台服务器上部署LNMP环境
1.3 案例架构图示
nginx的特长是处理静态请求效率非常强,擅长处理静态资源
apache更适合做动态处理
LNMP中,动态进程交给php中的fpm去处理
所以php需要额外安装fpm
1.4 先行安装nginx
1.4.1 安装编译包
[root@localhost ~]# yum install gcc gcc-c++ pcre* make cmake zlib-devel -y
1.4.2 将源码包导入到服务器内
[root@localhost ~]# mkdir /abc
[root@localhost ~]# mount.cifs //192.168.254.10/linuxs /abc
Password for root@//192.168.254.10/linuxs:
[root@localhost ~]# cd /abc/L
LAMP-C7/ LNMP-C7/
[root@localhost ~]# cd /abc/LNMP-C7/LNMP-C7/
[root@localhost LNMP-C7]# ls
Discuz_X3.4_SC_UTF8.zip nginx-1.12.2.tar.gz php-7.1.20.tar.bz2
mysql-boost-5.7.20.tar.gz php-5.6.11.tar.bz2 php-7.1.20.tar.gz
ncurses-5.6.tar.gz php-7.1.10.tar.bz2 zend-loader-php5.6-linux-x86_64_update1.tar.gz
[root@localhost LNMP-C7]#
1.4.3 解压源码包,创建nginx用户,使其无法登陆,没有家目录
[root@localhost LNMP-C7]# tar xzvf nginx-1.12.2.tar.gz -C /opt
[root@localhost LNMP-C7]# useradd -M -s /sbin/nologin nginx
[root@localhost LNMP-C7]# id nginx
uid=1001(nginx) gid=1001(nginx) groups=1001(nginx)
[root@localhost LNMP-C7]# ls /home
gsy
1.4.4 configure 配置,make编译
[root@localhost LNMP-C7]# cd /opt/nginx-1.12.2/
[root@localhost nginx-1.12.2]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@localhost nginx-1.12.2]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module
。。。。。。
[root@localhost nginx-1.12.2]# make && make install
。。。。。。
1.4.5 使nginx的命令脚本可以被系统识别,可以补全
[root@localhost nginx-1.12.2]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/
[root@localhost nginx-1.12.2]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
1.4.6 在/lib/systemd/system中配置nginx.service服务脚本,使nginx可以被systemctl所管理
[root@localhost nginx-1.12.2]# cd /lib/systemd/system
[root@localhost system]# vim nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/bin/kill -s HUP $MAINPID
ExecStop=/usr/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@localhost system]# chmod 754 nginx.service
[root@localhost system]# systemctl start nginx.service
[root@localhost system]# netstat -natp | grep "nginx"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 120555/nginx: maste
[root@localhost system]# systemctl stop firewalld.service
[root@localhost system]# setenforce 0
此时nginx安装完毕
开始安装MySQL
二:MySQL安装配置
2.1 为了与Nginx、PHP环境保持一致,此处选择采用源代码编译的方式安装MySQL组件
2.2 MySQL部署的方法
- 编译安装MySQL
- 优化调整
- 初始化数据库
- 启动mysql服务并设置root数据库账号的密码
2.3 安装mysql数据库
2.3.1 安装编译包
ncurses 客户字符终端处理工具
bison 分析MYSQL语法,函数库
cmake 用来编译
[root@localhost system]# yum install ncurses* bison cmake -y
2.3.2 创建mysql用户,使其无法正常登陆
[root@localhost system]# useradd -s /sbin/nologin mysql
[root@localhost system]# id mysql
uid=1002(mysql) gid=1002(mysql) groups=1002(mysql)
2.3.3 解压源码包到/opt下
[root@localhost system]# cd /abc/LNMP-C7/LNMP-C7
[root@localhost LNMP-C7]# tar xzvf mysql-boost-5.7.20.tar.gz -C /opt
[root@localhost LNMP-C7]# cd /opt
[root@localhost opt]# ls
mysql-5.7.20 nginx-1.12.2 rh
[root@localhost opt]# cd mysql-5.7.20/
[root@localhost mysql-5.7.20]# ls
boost configure.cmake INSTALL man README support-files
BUILD COPYING libbinlogevents mysql-test regex testclients
client dbug libbinlogstandalone mysys scripts unittest
cmake Docs libevent mysys_ssl sql VERSION
CMakeLists.txt Doxyfile-perfschema libmysql packaging sql-common vio
cmd-line-utils extra libmysqld plugin storage win
config.h.cmake include libservices rapid strings zlib
2.3.4 cmake配置属性,make编译安装
[root@localhost mysql-5.7.20]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ //指定安装路径
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ //指定链接性文件
-DSYSCONFDIR=/etc \ //指定配置文件
-DSYSTEMD_PID_DIR=/usr/local/mysql \ //指定PID文件路径
-DDEFAULT_CHARSET=utf8 \ //指定字符集
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ //下面还有四个存储引擎,后面会讲,有的存储引擎是不支持事务处理过程和一些存储过程,有一些是支持事物存储过程的,根据需求,去针对选择
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \ //数据存放位置
-DWITH_BOOST=boost \ //底层要支持g++的运行库
-DWITH_SYSTEMD=1 //用来支持去做mysql后面为了去做主从复制的时候的序列号
等了一辈子,终于make好了,之后make install
[root@localhost mysql-5.7.20]# make
[100%] Built target my_safe_process
[root@localhost mysql-5.7.20]# make install
2.3.5 设置mysql的软件目录的属主属组为mysql:mysql
[root@localhost mysql-5.7.20]# cd ..
[root@localhost opt]# ls
mysql-5.7.20 nginx-1.12.2 rh
[root@localhost opt]# cd /usr/local
[root@localhost local]# ls
bin etc games include lib lib64 libexec mysql nginx sbin share src
[root@localhost local]# ls -l
总用量 0
drwxr-xr-x. 11 root root 197 12月 23 22:12 mysql
[root@localhost local]# chown -R mysql:mysql /usr/local/mysql/
[root@localhost local]# ls -l
总用量 0
drwxr-xr-x. 11 mysql mysql 197 12月 23 22:12 mysql
2.3.6 编辑配置文件/etc/my.cnf,里面的内容全部删除,然后换成以下内容
[root@localhost local]# vim /etc/my.cnf
[client]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysql]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
character_set_server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket = /usr/local/mysql/mysql.sock
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
2.3.7 设置配置文件/etc/my.cnf的属主属组为mysql,将mysql的脚本目录加入到环境变量内,使mysql的脚本可以被系统识别
[root@localhost local]# chown mysql:mysql /etc/my.cnf
[root@localhost local]# echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
[root@localhost local]# echo 'export PATH' >> /etc/profile
[root@localhost local]# tail -2 /etc/profile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
[root@localhost local]# source /etc/profile
source使加入的数据生效,使mysql的相关命令识别
[root@localhost local]# cd /usr/local/mysql/
[root@localhost mysql]# ls
bin COPYING-test include man README share usr
COPYING docs lib mysql-test README-test support-files
[root@localhost mysql]#
[root@localhost mysql]# cd bin
[root@localhost bin]# ls
innochecksum mysql_config mysqlslap
lz4_decompress mysql_config_editor mysql_ssl_rsa_setup
myisamchk mysqld mysqltest
myisam_ftdump mysqld_pre_systemd mysqltest_embedded
myisamlog mysqldump mysql_tzinfo_to_sql
myisampack mysqldumpslow mysql_upgrade
my_print_defaults mysql_embedded mysqlxtest
mysql mysqlimport perror
mysqladmin mysql_install_db replace
mysqlbinlog mysql_plugin resolveip
mysqlcheck mysqlpump resolve_stack_dump
mysql_client_test mysql_secure_installation zlib_decompress
mysql_client_test_embedded mysqlshow
2.3.8 初始化数据库,使用mysqld进行初始化
[root@localhost bin]# pwd
/usr/local/mysql/bin
[root@localhost bin]# cd ..
[root@localhost mysql]# pwd
/usr/local/mysql
[root@localhost mysql]#
[root@localhost mysql]# ls
bin COPYING-test include man README share usr
COPYING docs lib mysql-test README-test support-files
[root@localhost mysql]# bin/mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
2.3.9 将mysql的服务脚本从软件内复制到/lib/systemd/system中
[root@localhost mysql]# cp usr/lib/systemd/system/mysqld.service /lib/systemd/system/
[root@localhost system]# ls -l mysqld.service
-rw-r--r--. 1 root root 1639 Dec 23 17:33 mysqld.service
2.3.10 开启服务,设置mysqld为开机自启动
[root@localhost system]# systemctl start mysqld.service
[root@localhost system]# netstat -natp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 120555/nginx: maste
[root@localhost system]# netstat -natp | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 7718/mysqld
[root@localhost mysql]# systemctl enable mysqld
2.3.11 设置mysql服务的管理员密码
[root@localhost mysql]# mysqladmin -uroot -p password
Enter password:
New password: 12341234
Confirm new password: 12341234
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
2.3.12 登录数据库
[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.20 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quit
Bye
[root@localhost mysql]#
接下来安装PHP
三:PHP解析环境
3.1 配置网页动静分离,解析PHP,有两种方法可以选择
- 使用PHP的FPM模块
- 将访问PHP页面的WEB请求转交给Apahche服务器去处理
3.2 较新版本的PHP已经自带FPM模块,用来对PHP解析实例进行管理、优化解析效率
- FastCGI将Http Server和动态脚本语言分离开
- Nginx专门处理静态请求,转发动态请求
- PHP_FPM专门解析PHP动态请求
3.3 单服务器的LNMP架构通常使用FPM的方式来解析PHP
fastcgi可以跨平台,可以作用在linux,也可作用在win
四:PHP解析环境的安装
4.1 PHP编译安装步骤
- 编译安装PHP
- 编译选项时添加”–enable-fpm“以启用此模块
- 安装后的调整,主要是配置文件的建立与相应命令工具的路径优化
- 安装ZengGuardLoader(提高PHP解析效率),并进行加载配置
4.2 安装PHP
4.2.1 安装编译包
[root@localhost mysql]# yum -y install \
libjpeg \ //jpeg图片识别
libjpeg-devel \ //jpeg开发包
libpng libpng-devel \ //png图片识别还有开发包
freetype freetype-devel \ //freetype 识别字体
libxml2 \ //xml文件格式识别
libxml2-devel \
zlib zlib-devel \ //zlib压缩
curl curl-devel \ //curl 支持文件上传下载,网页端的下载
openssl openssl-devel //身份验证去连接网站
4.2.2 解压源码包
[root@localhost mysql]# cd /abc/LNMP-C7/LNMP-C7/
[root@localhost LNMP-C7]# ls
Discuz_X3.4_SC_UTF8.zip php-7.1.10.tar.bz2
mysql-boost-5.7.20.tar.gz php-7.1.20.tar.bz2
ncurses-5.6.tar.gz php-7.1.20.tar.gz
nginx-1.12.2.tar.gz zend-loader-php5.6-linux-x86_64_update1.tar.gz
[root@localhost LNMP-C7]# tar jxvf php-7.1.10.tar.bz2 -C /opt
4.2.3 configure配置属性,make编译
[root@localhost LNMP-C7]# cd /opt/php-7.1.10/
[root@localhost php-7.1.10]# ls
acinclude.m4 footer mkinstalldirs README.PARAMETER_PARSING_API snapshot
aclocal.m4 generated_lists netware README.REDIST.BINS stamp-h.in
appveyor genfiles NEWS README.RELEASE_PROCESS stub.c
build header pear README.SELF-CONTAINED-EXTENSIONS tests
buildconf INSTALL php7.spec.in README.STREAMS travis
buildconf.bat install-sh php.gif README.SUBMITTING_PATCH TSRM
CODING_STANDARDS LICENSE php.ini-development README.TESTING UPGRADING
config.guess ltmain.sh php.ini-production README.TESTING2 UPGRADING.INTERNALS
config.sub main README.EXT_SKEL README.UNIX-BUILD-SYSTEM vcsclean
configure makedist README.GIT-RULES README.WIN32-BUILD-SYSTEM win32
configure.in Makefile.frag README.input_filter run-tests.php Zend
CONTRIBUTING.md Makefile.gcov README.MAILINGLIST_RULES sapi
CREDITS Makefile.global README.md scripts
ext makerpm README.namespaces server-tests-config.php
EXTENSIONS missing README.NEW-OUTPUT-API server-tests.php
[root@localhost php-7.1.10]#./configure \
--prefix=/usr/local/php \ //指定安装目录
--with-mysql-sock=/usr/local/mysql/mysql.sock \ //指向mysql的sock文件,用以后台程序去连接数据库
--with-mysqli \ //客户终端工具,可以直接去访问mysql服务器,去找它进行定义存储过程,事务的处理一些功能
--with-zlib \
--with-curl \
--with-gd \ //gd 是一个图像化的处理
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-fpm \ //fpm 是指动态请求的模块
--enable-mbstring \ //mbstring 多节点字符串
--enable-xml \ //xml 启用xml格式支持
--enable-session \ //支持session会话
--enable-ftp \ //网页可以ftp的功能
--enable-pdo \ //pdo 类似一个通用的接口一样,下面的不同的数据库的数据,会统一接口接收
--enable-tokenizer \ //tokenizer 是一个函数库
--enable-zip //zip 压缩
make && make install
[root@localhost php-7.1.10]# make && make install
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/opt/php-7.1.10/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
4.2.4 接下来就是配置优化的过程(修改三个配置文件)
4.2.4.1 核心配置文件php.ini
[root@localhost php-7.1.10]# cp php.ini-development /usr/local/php/lib/php.ini
[root@localhost php-7.1.10]# vim /usr/local/php/lib/php.ini
937 ; Defines the default timezone used by the date functions
938 ; http://php.net/date.timezone
'939 date.timezone = Asia/Shanghai
1167 ; Default socket name for local MySQL connects. If empty, uses the built-in
1168 ; MySQL defaults.
1169 ; http://php.net/mysqli.default-socket
'1170 mysqli.default_socket = /usr/local/mysql/mysql.sock
保存退出,主配置文件改好了
/usr/local/php/bin/php -m 验证安装的模块
[root@localhost php-7.1.10]# /usr/local/php/bin/php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
[root@localhost php-7.1.10]#
4.2.4.2 进程服务配置文件php-fpm.conf
[root@localhost php-7.1.10]# cd /usr/local/php
[root@localhost php]# ls
bin etc include lib php sbin var
[root@localhost php]# cd etc
[root@localhost etc]# ls
pear.conf php-fpm.conf.default php-fpm.d
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# vim php-fpm.conf
13 [global]
14 ; Pid file
15 ; Note: the default prefix is /usr/local/php/var
16 ; Default Value: none
' 17 pid = run/php-fpm.pid
18
4.2.4.3 扩展配置文件 www.conf
[root@localhost etc]# cd php-fpm.d/
[root@localhost php-fpm.d]# ls
www.conf.default
[root@localhost php-fpm.d]# cp www.conf.default www.conf
4.2.5 创建软连接
[root@localhost php-fpm.d]# ln -s /usr/local/php/bin/* /usr/local/bin
4.2.6 开启服务
[root@localhost php-fpm.d]# /usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
//开启运行,这条很重要
[root@localhost php-fpm.d]# netstat -natp | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 81299/php-fpm: mast
五:配置Nginx支持PHP环境
5.1 调用本机的phh-fpm进程配置方法
- 建立FPM配置文件php-fpm.conf,修改配置选项,如:PID文件、运行用户、服务进程数等
- 启动php-fpm进程
5.2 在Nginx的配置文件中的server{}配置段配置将PHP的网页请求转给FPM模块处理
5.3 修改nginx的配置文件
[root@localhost php-fpm.d]# cd /usr/local/nginx/conf/
[root@localhost conf]# ls
fastcgi.conf fastcgi_params.default mime.types nginx.conf.default uwsgi_params
fastcgi.conf.default koi-utf mime.types.default scgi_params uwsgi_params.default
fastcgi_params koi-win nginx.conf scgi_params.default win-utf
[root@localhost conf]# vim nginx.conf
65 location ~ \.php$ {
66 root html;
67 fastcgi_pass 127.0.0.1:9000;
68 fastcgi_index index.php;
69 fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
70 include fastcgi_params;
71 }
5.3.1 重启服务
[root@localhost conf]# systemctl stop nginx.service
[root@localhost conf]# systemctl start nginx.service
六:常见的PHP开源产品介绍
6.1 Discuz!
- 康盛创想(北京)科技有限公司推出的一套通用的社区论坛软件系统,2001年6月面世以来,是全球成熟度最高、覆盖率最大的论坛软件系统之一
6.2 PHPWind
- PHPWind(简称:PW)是一个基于PHP和MySQL的论坛程序,是国内最受欢迎的通用型论坛程序之一。PHPWind的前身是ofstar,发布于2004年,PHPWind由杭州德天信息技术有限公司开发,软件全面开源免费
6.3 安装Discuz!
6.3.1 切换到站点,验证LNMP是否工作正常
[root@localhost conf]# cd /usr/local/nginx/html/
[root@localhost html]# ls
50x.html index.html
[root@localhost html]# mv index.html index.php
[root@localhost html]# vim index.php
<?php
phpinfo();
?>
6.3.2 接下来安装论坛,首先先创建数据库
[root@localhost html]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.20 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> CREATE DATABASE bbs;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bbs |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.01 sec)
mysql> quit
Bye
6.3.3 解压软件包
[root@localhost html]# cd /abc/LNMP-C7/LNMP-C7/
[root@localhost LNMP-C7]# ls
Discuz_X3.4_SC_UTF8.zip nginx-1.12.2.tar.gz php-7.1.20.tar.bz2
mysql-boost-5.7.20.tar.gz php-5.6.11.tar.bz2 php-7.1.20.tar.gz
ncurses-5.6.tar.gz php-7.1.10.tar.bz2 zend-loader-php5.6-linux-x86_64_update1.tar.gz
[root@localhost LNMP-C7]# unzip Discuz_X3.4_SC_UTF8.zip -d /opt/
6.3.4 配置相关文件目录的权限,属主属组
[root@localhost LNMP-C7]# cd /opt
[root@localhost opt]# ls
dir_SC_UTF8 mysql-5.7.20 nginx-1.12.2 php-7.1.10 rh 说明.htm
[root@localhost opt]# cd dir_SC_UTF8/
[root@localhost dir_SC_UTF8]# ls
readme upload utility
[root@localhost dir_SC_UTF8]# cp -r upload/ /usr/local/nginx/html/bbs
[root@localhost dir_SC_UTF8]# cd /usr/local/nginx/html/bbs/
[root@localhost bbs]# ls -l
总用量 68
-rw-r--r--. 1 root root 2748 12月 23 23:21 admin.php
drwxr-xr-x. 10 root root 149 12月 23 23:21 api
-rw-r--r--. 1 root root 727 12月 23 23:21 api.php
drwxr-xr-x. 2 root root 23 12月 23 23:21 archiver
drwxr-xr-x. 2 root root 90 12月 23 23:21 config
-rw-r--r--. 1 root root 1017 12月 23 23:21 connect.php
-rw-r--r--. 1 root root 106 12月 23 23:21 crossdomain.xml
drwxr-xr-x. 12 root root 202 12月 23 23:21 data
-rw-r--r--. 1 root root 5558 12月 23 23:21 favicon.ico
-rw-r--r--. 1 root root 2245 12月 23 23:21 forum.php
-rw-r--r--. 1 root root 821 12月 23 23:21 group.php
-rw-r--r--. 1 root root 1280 12月 23 23:21 home.php
-rw-r--r--. 1 root root 5885 12月 23 23:21 index.php
drwxr-xr-x. 5 root root 64 12月 23 23:21 install
drwxr-xr-x. 2 root root 23 12月 23 23:21 m
-rw-r--r--. 1 root root 1025 12月 23 23:21 member.php
-rw-r--r--. 1 root root 2435 12月 23 23:21 misc.php
-rw-r--r--. 1 root root 1788 12月 23 23:21 plugin.php
-rw-r--r--. 1 root root 977 12月 23 23:21 portal.php
-rw-r--r--. 1 root root 582 12月 23 23:21 robots.txt
-rw-r--r--. 1 root root 1155 12月 23 23:21 search.php
drwxr-xr-x. 10 root root 168 12月 23 23:21 source
drwxr-xr-x. 7 root root 86 12月 23 23:21 static
drwxr-xr-x. 3 root root 38 12月 23 23:21 template
drwxr-xr-x. 7 root root 106 12月 23 23:21 uc_client
drwxr-xr-x. 14 root root 256 12月 23 23:21 uc_server
[root@localhost bbs]# chown -R root:nginx ./config/
[root@localhost bbs]# chown -R root:nginx ./data/
[root@localhost bbs]# chown -R root:nginx ./uc_client/
[root@localhost bbs]# chown -R root:nginx ./uc_server/
[root@localhost bbs]# chmod -R 777 ./config/
[root@localhost bbs]# chmod -R 777 ./data/
[root@localhost bbs]# chmod -R 777 ./uc_client/
[root@localhost bbs]# chmod -R 777 ./uc_server/
6.3.5 在线安装Discuz!
全新安装
数据库名填bbs
管理员密码是自己设置新的
总结
- LNMP架构的组成
- PHP解析方法
- 使用PHP的FPM模块4
- 将访问PHP页面的Web请求转交给Apache服务器去处理
- LNMP架构下部署应用