ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

LNMP-安装Nginx

2019-09-24 15:58:09  阅读:204  来源: 互联网

标签:1.6 nginx root ghs LNMP module Nginx 安装


LNMP介绍 LNMP和LAMP应用场景相同,不同的就是web服务是由NGINX提供,并且php是作为一个独立服务存在的,这个服务叫做php-fpm
Nginx直接处理静态请求,动态请求会转发给php-fpm

 

 


LNMP工作原理 Nginx本身不会对PHP进行解析,终端对PHP过来页面请求会被Nginx交给FastCGI进程监听IP和端口,由php-fpm作为动态解析服务器处理,最后将处理结果再返回给nginx。其实,Nginx就是一个反向代理服务器。Nginx通过反向代理功能将动态请求转向后端php-fpm,从而实现对PHP的解析支持,这就是Nginx实现PHP动态解析的原理。     1:下载源码包 [root@ghs etc]# wget http://nginx.org/download/nginx-1.6.2.tar.gz   2:解压 [root@ghs tmp]# tar -zxvf nginx-1.6.2.tar.gz   3:编译Nginx环境 [root@ghs nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --with-pcre   初始化中出现的错误 ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option. 提示错误缺少pcre包   ./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option. 提示错误缺少zlib-devel包    解决方法 yum -y install pcre-devel   zlib-devel   [root@ghs nginx-1.6.2]# make   [root@ghs nginx-1.6.2]# make install   4:设置环境变量 [root@ghs nginx-1.6.2]# vim /etc/profile.d/path.sh #!/bin/bash export PATH=$PATH:/usr/local/nginx/sbin   [root@ghs nginx-1.6.2]# source !$   5:启动nginx [root@ghs nginx-1.6.2]# nginx [root@ghs nginx-1.6.2]]# ps aux|grep nginx root     16203  0.0  0.0  48960  3300 ?        Ss   Jun01   0:00 nginx: master process nginx nobody   18542  0.0  0.2  74712  8324 ?        S    Aug26  22:44 nginx: worker process nobody   18543  0.2  0.2  74720  8388 ?        S    Aug26  84:12 nginx: worker process root     30071  0.0  0.0 112708   980 pts/0    R+   15:33   0:00 grep --color=auto nginx  

标签:1.6,nginx,root,ghs,LNMP,module,Nginx,安装
来源: https://www.cnblogs.com/douyi/p/11578695.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有