LNMP是一组众所周知的Web网站服务器架构环境,即由Linux+Nginx+MySQL+PHP(MySQL有时也指 Mariadb)组合成一个高性能、轻量、稳定、扩展性强的Web网站服务器架构环境。
Nginx ("engine x") 作为Web服务器软件,是一个轻量级、高性能的HTTP和反向代理服务器,负 载均衡服务器,及电子邮件IMAP/POP3/SMTP 服务器。Nginx性能稳定、功能丰富、运维简单、效率高 、并发能力强、处理静态文件速度快且消耗系统资源极少。
Nginx的依赖程序
1、zlib:用于支持gzip模块
2、pcre:用于支持rewrite模块
3、openssl:用于支持ssl功能
使用yum安装zlib、pcre、openssl软件包
[root@www ~]# yum install zlib pcre pcre-devel openssl openssl-devel
[root@www ~]# useradd -s /sbin/nologin nginx
--user 指定启动程序所属用户
--group 指定组
--prefix 指定安装路径
--sbin-path 设置nginx二进制文件的路径名
--conf-path 指定配置文件路径
--error-log-path 错误日志文件路径
--http-log-path 指定访问日志文件路径
--http-client-body-temp-path 设置存储HTTP客户端请求主体的临时文件路径
--http-proxy-temp-path 设置存储HTTP代理临时文件的路径
--http-fastcgi-temp-path 设置存储HTTP fastcgi的临时文件的路径
--pid-path 设置nginx.pid文件路径
--lock-path 设置nginx.lock文件路径
--with-openssl 启用SSL
--with-pcre 启用正则表达式
--with-http_stub_status_module 安装可以监控nginx状态的模块
--with-http_ssl_module 启用SSL支持
--with-http_gzip_static_module 启用gzip压缩
[root@test1 src]# wget http://nginx.org/download/nginx-1.14.2.tar.gz
[root@test1 src]# tar zxf nginx-1.14.2.tar.gz
[root@www nginx-1.8.1]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx-1.14.2 --with-http_stub_status_module --with-http_ssl_module --with-file-aio
如果编译没有报错,则进行编译安装
make && make install
做一个软链接
ln -s /usr/local/nginx-1.14.2/ /usr/local/nginx
检测配置是否正常
[root@test1 nginx]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
原文:https://www.cnblogs.com/levinli/p/10413654.html