情感测试
情感测试

您现在的位置: 情感测试简介_情感测试玩法 > 情感测试规则 > 小成本的负载均衡器nginx

小成本的负载均衡器nginx

发布时间:2021-8-26 12:03:15   点击数:

“相遇是一种缘分”

初衷

其实,如论是开发、运维还是安全,讲的都是计算机知识。作为人类的智慧产物。知识可以分类,但不能过于强调技能分类。而应该分清深浅,并且最终应该得是串联。如果我们一味强调学习什么,那么可能从一开始的认知上就很局限性了。

我相信在大多数企业在建立负载均衡器方面是有曾考虑过nginx的。因此ngnix的活跃性才丝毫没有被淡忘。从个人来讲nginx是自由软件且口碑又好,足够为私人网站提供高可靠和便利条件,如果将其作为反向代理,能够直接屏蔽服务器的真实IP。如果不能应用这么好用的东西往后有何颜面跟人家夸夸其谈。

目前网上有许多部署nginx的方案,更甚有docker的一部署策略支持,可谓是开箱即用了。但是我们今天还是选择通过编译安装的方式来熟悉一下这套产品。

实践

以上是结构

0x01准备:

作为nginx服务器:CentOSLinuxrelease7.8.(Core)NAME="CentOSLinux"VERSION="7(Core)"ID="centos"ID_LIKE="rhelfedora"VERSION_ID="7"再准备两三台后端服务器:metasploitable

0x02nginx搭建:

1.到网上平台下载Nginx相关的组件

2.然后解压并编译安装

makemakeinstall分别在四个目录进行执行

[root

localhostopenssl-fips-2.0.10]#./configmakemakeinstall

[root

localhostpcre-8.40]#./configuremakemakeinstall

[root

localhostzlib-1.2.11]#./configuremakemakeinstall

[root

localhostnginx-1.10.2]#./configuremakemakeinstall

注:make作为编译安装之所以能进行,是当前或制定路径下的有Makefile规则文件,该文件按一定规则将软件包通过gcc-c++去组合并编译

default:buildclean:rm-rfMakefileobjsbuild:$(MAKE)-fobjs/Makefileinstall:$(MAKE)-fobjs/Makefileinstallmodules:$(MAKE)-fobjs/Makefilemodulesupgrade:/usr/local/nginx/sbin/nginx-tkill-USR2`cat/usr/local/nginx/logs/nginx.pid`sleep1test-f/usr/local/nginx/logs/nginx.pid.oldbinkill-QUIT`cat/usr/local/nginx/logs/nginx.pid.oldbin`

所以文件更新的位置等可以通过修改Makefile规则去改变。

3.启动服务

编译后默认会启动nginx服务,或者手动启动:/usr/local/nginx/sbin/nginx

更多操作:

[root

localhostnginx-1.10.2]#/usr/local/nginx/sbin/nginx-hnginxversion:nginx/1.10.2Usage:nginx[-?hvVtTq][-ssignal][-cfilename][-pprefix][-gdirectives]Options:-?,-h:thishelp-v:showversionandexit-V:showversionandconfigureoptionsthenexit-t:testconfigurationandexit-T:testconfiguration,dumpitandexit-q:suppressnon-errormessagesduringconfigurationtesting-ssignal:sendsignaltoamasterprocess:stop,quit,reopen,reload-pprefix:setprefixpath(default:/usr/local/nginx/)-cfilename:setconfigurationfile(default:conf/nginx.conf)-gdirectives:setglobaldirectivesoutofconfigurationfile更多操作,可以通过参数help提供信息帮助例如,我们要停止nginx服务[root

localhostnginx-1.10.2]#/usr/local/nginx/sbin/nginx-sstop然后验证一下(起停):4.nginx.conf配置nginx文件结构:相关文件

转载请注明:http://www.zmax-alibaba.com/qggz/138068.html

网站简介 | 发布优势 | 服务条款 | 隐私保护 | 广告合作 | 合作伙伴 | 版权申明 | 网站地图

当前时间: