编译安装LNMP架构之康盛创想论坛

  

LNMP架构

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

编译安装LNMP架构之康盛创想论坛”> </p>
  <h3> LNMP架构组件</h3>
  <pre> <代码> Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统。
  Nginx是一个高性能的HTTP和反向代理服务器。
  Mysql是一个小型关系型数据库管理系统。
  PHP是一种在服务器端执行的嵌入HTML文档的脚本语言。</代码> </pre>
  <h3>灯的优势</h3>
  <pre> <代码> Nginx性能稳定,功能丰富,运维简单,处理静态文件速度快且消耗系统资源极少,小巧高效。</代码> </pre>
  <人力资源/>
  <h3>演示步骤:</h3>
  <h4>第一步:在Linux上使用远程共享获取来自Windows共享的源码包</h4>
  <pre> <代码类= [root@localhost ~] # smbclient - l//192.168.235.1/# #远程共享访问   进入SAMBA \ root的密码:      Sharename类型的评论   - - - - - - - - - - - - - - - - - - - - - - - -   LNMP磁盘   root@localhost ~ # mkdir/abc   root@localhost ~ #山。cifs//192.168.235.1/LNMP/abc   # #挂载到/abc目录下   

第二步:编译安装Nginx

  
1,解压源码包到/opt目录
  
 <代码类=" language-bash "> [root@localhost ~] # cd/abc # #切换到挂载点目录
  (root@localhost abc) # ls
  Discuz_X3.4_SC_UTF8。zip nginx-1.12.2.tar.gz
  mysql-boost-5.7.20.tar。广州php-7.1.10.tar.gz
  (root@localhost abc) #焦油zxvf nginx-1.12.2.tar。广州- c/opt # #解压Nginx源码包到/opt下
  (root@localhost abc) # cd/opt/# #切换到解压的目录下
  root@localhost选择# ls
  nginx-1.12.2 rh  
  
2,安装编译需要的环境组件包
  
 <代码类=" language-bash ">安装\ [root@localhost选择]# yum - y
  gcc \//c语言
  gcc-c + + \//c++语言
  pcre-devel \//pcre语言工具
  zlib-devel//数据压缩函数库代码 
  
3,创建程序用户nginx并配置nginx编译参数
  
 <代码类=" language-bash "> [root@localhost选择]# useradd - m - s/sbin/nologin nginx # #创建程序用户,限定其
  [root@localhost选择]# cd nginx-1.12.2/# #切换到nginx目录下
  [root@localhost nginx-1.12.2] # ./configure \ # #配置nginx
  比;——prefix=/usr/地方/nginx \ # #安装路径
  比;——用户=nginx \ # #用户名
  比;——组=nginx \ # #用户组
  比;——with-http_stub_status_module # #访问状态统计模块 
  
4,编译和安装
  
 <代码类=" language-bash "> [root@localhost nginx-1.12.2] #做,,使安装 
  
5,优化Nginx服务启动脚本,并建立命令软链接h5> <代码类=" language-bash "> [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 # #开启nginx服务   
6,制作服务管理nginx脚本
  
 <代码类=" language-bash "> [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服务控制脚本
  学监="/usr/地方/nginx/sbin/nginx”# #设置变量为nginx命令文件
  PIDF="/usr/地方/nginx/logs/nginx。pid”# #设置变量pid文件进程号为5346
  “1美元”
  开始)
  美元掠夺# #开启服务
  ;;
  停止)
  杀- s退出美元(猫PIDF美元)# #关闭服务
  ;;
  重启)# #重启服务
  0美元停止
  $ 0开始
  ;;
  重载)# #重载服务
  杀- s玫瑰(猫PIDF美元美元)
  ;;
  *)# #错误输入提示
  回声”用法:$ 0{启动|停止| |重启重载}”
  出口1
  esac
  退出0
  [root@localhost init。d] # chmod + x/etc/init.d/nginx # #授予启动脚本执行权限
  [root@localhost init。d] # chkconfig——添加nginx # #添加到服务管理器
  [root@localhost init。d] nginx停止# # #服务使用服务停止nginx服务
  [root@localhost init。d] nginx开始# # #服务使用服务启动nginx服务

编译安装LNMP架构之康盛创想论坛