Nginx 编译安装

1. 编译安装nginx

1.1 安装PCRE(Perl Compatible Regular Expressions),中文perl兼容正则表达式.

bash-4.3 ~# yum -y install pcre pcre-devel

bash-4.3 ~# rpm -qa | grep pcre*

pcre-7.8-7.el6.x86_64

pcre-devel-7.8-7.el6.x86_64

1.2 安装openssl

bash-4.3 ~# yum -y install openssl-devel
1.3 安装Nginx

bash-4.3 ~# cd /usr/local/src

bash-4.3 src# wget http://nginx.org/download/nginx-1.10.1.tar.gz

bash-4.3 src# tar xf nginx-1.10.1.tar.gz

bash-4.3 src# cd nginx-1.10.1

bash-4.3 nginx-1.10.1# useradd -M -s /sbin/nologin nginx

bash-4.3 nginx-1.10.1# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

### --user、--group: 用户和组

### --with-http_ssl_module: 加载ssl

### --with-http_stub_status_module: nginx监控

bash-4.3 nginx-1.10.1# echo $?

0

bash-4.3 nginx-1.10.1# make

bash-4.3 nginx-1.10.1# make install

bash-4.3 nginx-1.10.1# echo $?

0

bash-4.3 nginx-1.10.1# /usr/local/nginx/sbin/nginx -V   #查看Nginx配置参数

nginx version: nginx/1.10.1

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

1.4 Nginx目录介绍

bash-4.3 nginx-1.10.1#  cd /usr/local/nginx

bash-4.3 nginx# ll |awk ‘NR>3 {print $NF}‘

conf            #配置文件目录

html            #默认网站目录

logs            #日志目录

sbin            #Nginx启动命令

bash-4.3 nginx# /usr/local/nginx/sbin/nginx     #启动Nginx

bash-4.3 nginx# lsof -i:80                      #查看80端口

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

nginx   7669  root    6u  IPv4  25184      0t0  TCP *:http (LISTEN)

nginx   7670 nginx    6u  IPv4  25184      0t0  TCP *:http (LISTEN)

### 浏览器访问服务器ip

1.5 更改默认主页(index.html)信息

bash-4.3 nginx# cd html

bash-4.3 html# echo "<a href="http://www.90root.com">www.90root.com</a>" > index.html 

### 浏览器访问服务器ip

1.6 企业场景常用的Nginx http功能模块

ngx_http_core_module: 包括一些核心的http参数配置,对应Nginx的配置为http区块部分.

ngx_http_access_module: 访问控制模块,用来控制网站用户对Nginx的访问.

ngx_http_gzip_module: 压缩模块, 对Nginx返回的数据压缩,属于性能优化模块.

ngx_http_fastcgi_module: fastcgi模块和动态应用相关的模块.如php.

ngx_http_proxy_module: proxy代理模块.

ngx_http_upstream_module: 负载均衡模块

ngx_http_rewrite_module: URL地址重写模块

ngx_http_limit_conn_module: 限制用户并发连接数及请求数模块

ngx_http_limit_req_module: 限制Nginx request processing rate根据定义的key

ngx_http_log_module 访问日志模块,以指定的格式记录Nginx客户访问日志等信息

ngx_http_auth_basic_module: Web认证模块,设置Web用户通过账号密码访问Nginx

ngx_http_ssl_module: ssl模块,用于加密的http连接.如https

ngx_http_stub_status_module: 记录Nginx基本访问状态信息等模块

时间: 2024-08-06 10:28:42

Nginx 编译安装的相关文章

Nginx编译安装,启动,停止,升级。

1.简单介绍下Nginx Nginx是一款轻量级的web服务器和反向代理服务器,它使用了epoll的I/O模型,也就是事件触发I/O模型,减少了进程的生成切换所消耗的系统资源(CPU的压力减少,内存的占用也会减少),可以达到很高的并发请求.它是一款开源软件,企业成本降低,它的使用配置也比较简单,同时支持Rewrite,作为反向代理的时候可以检查后端的Web服务器的健康状况,能够支持热部署. 2.Nginx安装,重启,升级,停止. 环境是Centos系统,通过www.nginx.org下载需要的源

NGINX编译安装后添加新模块的方法

刚忙完研发又有新的需求过来,测试服务器的nginx需要有HttpUpstreamRequestHashModule和HttpStubStatusModule:擦!安装软件环境时怎么不说清楚:妹的,悲剧. 测试服务器崩溃的是不是我安装的软件,天啊.赶紧搞吧!!! 环境:centos 6.4 64位 编译安装nginx 1:查看nginx版本和安装时间带的具体参数  /usr/local/nginx/sbin/nginx  -V 2:下载相应的版本的nginx源码包[nginx-1.5.11.tar

nginx 编译安装 及错误解决。

nginx 编译安装 Nginx 是一个很强大的高性能Web和反向代理服务器,它具有很多非常优越的特性:在连接高并发的情况下,Nginx是Apache服务器不错的替代品:Nginx在美国是做虚拟主机生意的老板们经常选择的软件平台之一.能够支持高达 50,000 个并发连接数的响应.相比apache nginx处理静态页面更加优秀迅速,配置也相当简洁明了. nginx相对于apache的优点: 轻量级,同样起web 服务,比apache 占用更少的内存及资源 抗并发,nginx 处理请求是异步非阻

Linux下nginx编译安装教程和编译参数详解

这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # yum install pcre* //如过你已经装了,请跳过这一步 2.安装openssl 需要ssl的支持,如果不需要ssl支持,请跳过这一步 复制代码代码如下: # yum install openssl* 3.gzip 类库安装 复制代码代码如下: yum install zlib zlib-

Nginx编译安装Lua模块

Nginx编译安装Lua模块 一.安装Lua环境及相关库 官网网址:https://github.com/openresty/lua-nginx-module LuaJIT ` wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz make install PREFIX=/usr/local/LuaJIT export LUAJIT_LIB=/usr/local/LuaJIT/lib export LUAJIT_INC=/usr/local/Lu

Nginx编译安装及编译参数讲解

实验环境说明:操作系统:Centos 7 64位Nginx版本:Nginx 1.12.2 编译安装前的准备:安装Nginx编译安装需要依赖的一些包yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel -y #Nginx的编译安装及编译参数详解 Nginx的编译参数讲解--prefix=PATH set installation prefix #设置安装路径--sbin-path=PA

使用本脚本可以自动批量完成中间节点环境的部署工作,包括:Nginx编译安装、添加程序管理脚本、设置开机启动、反向代理配置、证书分发、添加iptables规则等

使用本脚本可以自动批量完成中间节点环境的部署工作,包括:Nginx编译安装.添加程序管理脚本.设置开机启动.反向代理配置.证书分发.添加iptables规则等.脚本支持自定义nginx安装版本.设置编译模块.配置监听端口等. 1. Nginx Role规则说明 本脚本用于中间节点(Nginx反向代理)环境的自动化配置,主要内容包括: 安装基础依赖环境: 创建nginx启动用户(支持自定义用户): 下载nginx安装文件(可自定义nginx版本): 解压安装文件: 执行编译安装(可自定义编译参数和

[linux] Nginx编译安装错误error: the HTTP rewrite module requires the PCRE library

nginx编译错误: 执行如下命令安装缺少的文件即可

2 nginx编译安装

一 安装nginx 1 下载 http://nginx.org/download/nginx-1.4.7.tar.gz 1.1 解压 # tar xf nginx-1.4.7.tar.gz 1.2 建立用户(为系统用户) # groupadd -r -g 110 nginx # useradd -r -g 110 -u 110 nginx 1.3 解决依赖关系 编译安装nginx需要事先需要安装开发包组"Development Tools"和 "Development Lib

LNMP 1.2 Nginx编译安装

Nginx官网是:nginx.org 下载稳定版本 cd /usr/local/src wget http://nginx.org/download/nginx-1.8.0.tar.gz tar zxvf nginx-1.8.0.tar.gz 编译安装 cd nginx-1.8.0 ./configure --prefix=/usr/local/nginx --with-pcre make make install 启动 /usr/local/nginx/sbin/nginx