LNMP架构之Discue论坛

  

LNMP架构

  
 <代码> LNMP平台就是Linux, Nginx, MySQL, PHP的组合架构,需要Linux服务器,MySQL服务器,PHP解析环境 
  

构成组件

  
 <代码> Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统。
  Nginx是一个高性能的HTTP和反向代理服务器。
  Mysql是一个小型关系型数据库管理系统。
  PHP是一种在服务器端执行的嵌入HTML文档的脚本语言。 
  

灯优势

  
 <代码> Nginx性能稳定,功能丰富,运维简单,处理静态文件速度快且消耗系统资源极少,小巧高效。 
  

一,在Windows上将灯所需压缩软件包共享出来(此处如有问题请看之前的博客相关文章)

  

 LNMP架构之Discue论坛”> </p>
  <h4>二,在Linux上使用远程共享获取文件并挂载到mnt目录下</h4>
  <pre> <代码> [root@localhost ~] # smbclient - l//192.168.100.3/# #远程共享访问
  进入SAMBA \ root的密码:
  
  Sharename类型的评论
  - - - - - - - - - - - - - - - - - - - - - - - -
  LNMP-C7磁盘
  root@localhost ~ #山。cifs//192.168.100.3/LNMP-C7/mnt # #挂载到/mnt目录下</代码> </pre>
  <h4>三、编译安装Nginx </h4>
  <h5> 1,解压源码包到/opt下,并查看</h5>
  <pre> <代码> [root@localhost ~] # cd/mnt # #切换到挂载点目录
  [root@localhost mnt] # ls
  Discuz_X3.4_SC_UTF8。zip nginx-1.12.2.tar.gz
  mysql-boost-5.7.20.tar。广州php-7.1.20.tar.gz
  [root@localhost mnt] #焦油zxvf nginx-1.12.2.tar。广州- c/opt # #解压Nginx源码包到/opt下
  [root@localhost mnt] # cd/opt/# #切换到解压的目录下
  root@localhost选择# ls
  nginx-1.12.2 rh </代码> </pre>
  <h5> 2,安装编译需要的环境组件包</h5>
  <pre> <代码>安装\ [root@localhost选择]# yum - y
  gcc \//c语言
  gcc-c + + \//c++语言
  pcre-devel \//pcre语言工具
  zlib-devel//数据压缩用的函式库代码</> </pre>
  <h5> 3,创建程序用户nginx并编译nginx h5> </<pre> <代码> [root@localhost选择]# useradd - m - s/sbin/nologin nginx # #创建程序用户,安全不可登陆状态
  [root@localhost选择]# id nginx
  uid=1001 (nginx) gid=1001 (nginx)组=1001 (nginx)
  [root@localhost选择]# cd nginx-1.12.0/# #切换到nginx目录下
  [root@localhost nginx-1.12.0] # ./configure \ # #配置nginx
  比;——prefix=/usr/地方/nginx \ # #安装路径
  比;——用户=nginx \ # #用户名
  比;——组=nginx \ # #用户组
  比;——with-http_stub_status_module # #状态统计模块</代码> </pre>
  <h5> 4,编译和安装</h5>
  <pre> <代码> [root@localhost nginx-1.12.0] #让# #编译
  …
  [root@localhost nginx-1.12.0] # make install # #安装
  …</代码> </pre>
  <h5> 5,优化nginx启动脚本,以便于系统识别h5> </<pre> <代码> [root@localhost nginx] # ln - s/usr/local/nginx/sbin/nginx/usr/local/sbin/# #创建软连接让系统识别nginx启动脚本
  [root@localhost nginx] # nginx - t # #检查配置文件的语法问题/usr/local/nginx/conf/nginx. nginx:配置文件配置语法好/usr/local/nginx/conf/nginx. nginx:配置文件配置测试是成功的
  [root@localhost nginx] # nginx # #开启ngnix
  [root@localhost nginx] # netstat -ntap | grep 80 # #查看端口,nginx已经开启
  tcp 0 0 0.0.0.0:80 0.0.0.0: * 39620/nginx听:主人
  [root@localhost nginx] # systemctl firewalld停止。服务# #关闭防火墙
  [root@localhost nginx] # setenforce 0
  [root@localhost nginx] # nginx # #开启</代码> </pre>
  <h5> 6,制作管理脚本,便于使用服务管理使用</h5>
  <pre> <代码> [root@localhost nginx] # cd/etc/init.d/# #切换到启动配置文件目录
  [root@localhost init。d] # ls
  函数netconsole网络自述
  [root@localhost init。d] # vim nginx # #编辑启动脚本文件
  
  # !/bin/bash
  20 # # # chkconfig: - 99注释信息
  描述:Nginx服务控制脚本
  学监=LNMP架构之Discue论坛