博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
面试Nginx的几个常见问题(
阅读量:4338 次
发布时间:2019-06-07

本文共 1489 字,大约阅读时间需要 4 分钟。

1、Nginx 服务器上的 Master 和 Worker 进程分别是什么

Master 进程:读取及评估配置和维持Worker 进程:处理请求

 

2、怎么添加模块?

Firstly, you have to select the Nginx module during the compile. Runtime selection of module is not being supported by the Nginx server. 在编译过程添加模块

 

3、什么是 C10K 问题?

C10K 问题是指无法同时处理大量客户端(10,000)的网络套接字。

 

4、在 Nginx 中,如何使用未定义的服务器名称来阻止处理请求? 

只需将请求删除的服务器就可以定义为: Server {listen 80;server_name “ “ ;return 444; }

 

5、Nginx和Apache的区别?

Firstly, Nginx is an event-based web server and Apache is a process-based server. 1、Nginx是事件驱动,Apache是过程驱动 Nginx is best known for its speed and Apache is best known for its power.Nginx is the best when it comes to memory consumption and connection whereas Apache is not best in this category.In Nginx, a single thread is handling all of the requests whereas in Apache single thread handles a single request.Nginx is best when you want the load balancing. But Apache will refuse the new connection when traffic reaches the limit of the process.Apache provides lots of functionality as compared to Nginx.

更为通用的方案是,前端 nginx 抗并发,后端 apache 集群,配合起来会更好。

 

6、Nginx是什么语言写的?

C语言

 

7、Nginx的负载均衡策略有哪几种?

调度策略 含义
轮询 按照时间顺序,逐一分配到不同的后端服务器
加权轮询 weight值越大,分配到的访问几率越高
ip_hash 每个请求按访问IP的hash结果分配,这样来自同一个IP的请求固定访问一个后端服务器,可以解决分布式session问题,但不是最优的解决办法,另一个即集中式session存储校验,将session放到redis集群当中。
url_hash(第三方) 按照访问的URL的hash结果来分配请求,使一个URL始终定向到同一个后端服务器
less_conn 最少连接数,哪个机器连接数少,就分发
fair(第三方) 按后端服务器的响应时间来分配请求,响应时间短的优先分配。
8、如何设置在81端口上运行nginx?
修改nginx.conf里的端口号

 

参考:

转载于:https://www.cnblogs.com/roostinghawk/p/11073511.html

你可能感兴趣的文章
并发量计算研究
查看>>
sqlserver安装相关问题
查看>>
iOS学习系列 - 利用ASIHTTPRequest实现异步队列
查看>>
Oracle11g创建表空间、创建用户、角色授权、导入导出表以及中文字符乱码问题...
查看>>
我对 Window.Open 的认识
查看>>
restore db from production copy
查看>>
jQuery源码的基础知识
查看>>
HDU 2188 悼念512汶川大地震遇难同胞——选拔志愿者
查看>>
BZOJ 2049 [Sdoi2008]Cave 洞穴勘测(动态树)
查看>>
LeetCode 第21题 合并有序链表
查看>>
Highcharts学习资料收集
查看>>
AtCoder Grand Contest 010 D - Decrementing
查看>>
坑备忘error: expected class-name before '{' token
查看>>
又双叒叕一个程序猿转行了
查看>>
Tiny4412 Uboot
查看>>
python基础之包的导入
查看>>
Autoregressive Convolutional Neural Networks for Asynchronous Time Series
查看>>
Python网络编程(进程池、进程间的通信)
查看>>
combotree的加载方法
查看>>
利用General框架开发RDLC报表
查看>>