设为首页 收藏本站
查看: 582|回复: 0

[经验分享] Nginx 编译安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-9-23 09:00:35 | 显示全部楼层 |阅读模式
1. 编译安装nginx1.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

nginx_3.1.png
1.5 更改默认主页(index.html)信息
bash-4.3 nginx# cd html
bash-4.3 html# echo "www.90root.com" > index.html  
### 浏览器访问服务器ip

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基本访问状态信息等模块



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-276206-1-1.html 上篇帖子: Nginx/LVS/HAProxy负载均衡软件的优缺点详解 下篇帖子: nginx对PHP文件报File not found.错
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表