首页 / NGINX / Nginx 编译安装
Nginx 编译安装
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Nginx 编译安装,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2782字,纯文字阅读大概需要4分钟。
内容图文
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
# 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
|
650) this.width=650;" src="http://oa8ttah2a.bkt.clouddn.com/nginx_3.1.png" />
1.5 更改默认主页(index.html)信息
bash
-4.3 nginx
# cd html
### 浏览器访问服务器ip
|
650) this.width=650;" src="http://oa8ttah2a.bkt.clouddn.com/nginx_3.2.png" />
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基本访问状态信息等模块
|
本文出自 “断肠人在天涯” 博客,请务必保留此出处http://8649605.blog.51cto.com/8639605/1855602
原文:http://8649605.blog.51cto.com/8639605/1855602
内容总结
以上是互联网集市为您收集整理的Nginx 编译安装全部内容,希望文章能够帮你解决Nginx 编译安装所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。