Nginx - technical topics - getting started

InfoQ 2020-11-08 16:10:27
nginx technical topics getting started


{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":" Nginx What is it? "},{"type":"text","text":":"},{"type":"codeinline","content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":"Nginx Is a high-performance HTTP And reverse proxy web The server . It also provides IMAP/POP3/SMTP service ."}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"       "},{"type":"text","marks":[{"type":"strong"}],"text":"Nginx Characteristics "},{"type":"text","text":":"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" Open source 、 Less memory 、 Lightweight 、 High performance ( There's a report on the surface nginx Can support up to 500000 Number of concurrent connections )、 Support hot deployment ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        In the official introduction nginx Before , Let's first introduce some related nouns :"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" Forward agency 、 Reverse proxy 、 Load balancing 、 Dynamic and static separation "},{"type":"text","text":"."}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":" Forward agency 、 Reverse proxy "}]},{"type":"horizontalrule"},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        The main difference between forward proxy and reverse proxy is that the proxy object is different :"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The object of the forward proxy agent is the client ; The object of the reverse proxy agent is the server ."}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        Forward agency ,"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The object of the proxy is the client "},{"type":"text","text":"."}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Proxy in the direction of the request ."},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The process of forward agency , Hide the real request client , The server does not know who the real client is , The services requested by clients are replaced by proxy servers to request ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"       A Students start businesses in the public 、 Under the background of mass innovation, he started his business , At present, one of the biggest problems he has encountered is to start funding , So he decided to go to Ma Yun's father to borrow money , As one can imagine , Finally I came back with a snuff , Under the feeling be nasty , He came up with a way , Find a relationship and open the back door , After a bit of information , original A Mr. Wang is a classmate of Ma Yun , therefore A Students find Miss Wang , Ask Miss Wang to lend it to Ma Yun 500 Come here , Of course, in the end . But Ma Yun didn't know that the money was A I borrowed it from my classmates , Ma Yun lent it to Miss Wang , Finally, Mr. Wang gave it to A classmate . Mr. Wang here plays a very important role in this process , It's the agent , It can also be said to be a positive agent ,"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" Mr. Wang took the place of A Students do this , In the process , Who is the real borrower , Ma Yun doesn't know , This is very important ."}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        Reverse proxy ,"},{"type":"text","marks":[{"type":"strong"}],"text":" The object of proxy is the server "},{"type":"text","text":"."}]}]},{"type":"paragraph","attrs":{"indent":1,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The process of reverse proxy , Hiding the real server . The client does not know who the real server is ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        call 10086 Customer service number , Maybe in a region 10086 There are several or dozens of customer service , You never need to care which one is on the other end of the phone , What is called? , male , It's still a woman , Beautiful or handsome , You don't care , What you are concerned about is whether your question can be answered professionally , You just need to dial through 10086 The switchboard number of , There will always be someone at the other end of the line who will answer you , It's just that sometimes it's slow and sometimes it's fast . So here 10086 The switchboard number is what we call reverse agent ."},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The customer doesn't know who the real service provider is "},{"type":"text","text":"."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}}],"text":" therefore , Forward agency 、 We just need to remember a little bit about reverse agency ,"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The object of forward proxy is the client ; The object of reverse proxy is the server side "},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}}],"text":". The forward code server does not know the client , Hidden is the client ; Reverse agent customer service side does not know the server side , Hidden is the server side ."}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":" Load balancing "}]},{"type":"horizontalrule"},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The English name of load balancing is Load Balance, It means to load ( Work task ) Balance 、 Allocate to multiple operation units for operation , for example FTP The server 、Web The server 、 Enterprise core application servers and other main task servers , So that we can work together to complete the task ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" "},{"type":"text","marks":[{"type":"strong"}],"text":" Load balancing "},{"type":"text","text":" To put it bluntly, a single server can't handle it , By increasing the number of servers , Distribute the requests from the client to different servers , Balance the workload . It is generally used in high concurrency scenarios ."}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":" Dynamic and static separation "}]},{"type":"horizontalrule"},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" The separation of movement and stillness means that in web In the server architecture , Architecture design method that separates static page from dynamic page or static content interface and dynamic content interface , And then improve the access performance and maintainability of the whole service ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Distinguish dynamic requests from static requests .html、css、js It belongs to static resources ;url request 、jsp、servlet It's a dynamic resource ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":" How to separate static and dynamic : Put the static resources on the static resource server (Nginx The server ), Dynamic resources are deployed in tomcat Server . "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Nginx As requested by the client url To determine whether the request is a static resource , If requested url contain jpg、png, By Nginx Handle ; If requested url yes .php perhaps .jsp wait , At this time, the request is dynamic , Forward to tomcat Handle ."}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"Nginx install "}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"1.1 windows Next nginx Installation "}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1.1.1 nginx download "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        Enter official website "},{"type":"link","attrs":{"href":"https://links.jianshu.com/go?to=http%3A%2F%2Fnginx.org%2Fen%2Fdownload.html","title":null},"content":[{"type":"text","text":"http://nginx.org/en/download.html"}]},{"type":"text","text":" Download the corresponding stable version to local ( For example, what we download here is nginx-1.18.0.zip)."}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/8c/8c5103774c5bae6537cae125dfd6464b.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1.1.2 nginx install & start-up "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        After the download is successful , Unzip the downloaded file to the specified directory . double-click nginx.exe And it started nginx.nginx The default monitor is 80 port ."}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/08/08fe1e7b9a60ccc87b88edf5e7a6180e.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":1,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Type in the browser http://127.0.0.1:80 Successfully visited nginx."}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/79/79e1584a0e67beedf0db1e73c0e18042.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"1.2 linux Next nginx install "}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1.2.1 nginx Dependent installation "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"      install nginx Make sure that... Is correctly installed in the system "},{"type":"text","marks":[{"type":"strong"}],"text":"gcc、pcre-devel、zlib-devel、openssl、openssl-devel"},{"type":"text","text":"."}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"# Check to see if it is installed **gcc、pcre-devel、zlib-devel、openssl、openssl-devel**\nyum list installed | grep \"gcc\" # Judge whether it is in accordance with gcc\nyum list installed | grep \"pcre-devel\" # Judge whether it is in accordance with pcre-devel\nyum list installed | grep \"zlib-devel\" # Judge whether it is in accordance with zlib-devel\nyum list installed | grep \"openssl\" # Judge whether it is in accordance with openssl\nyum list installed | grep \"openssl-devel\" # Judge whether it is in accordance with openssl-devel\n# Which one is not installed should be installed accordingly \nyum -y install gcc pcre-devel zlib-devel openssl openssl-devel"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1.2.2 nginx download "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"        Enter the official website to download the stable version of the corresponding system ."},{"type":"link","attrs":{"href":"https://links.jianshu.com/go?to=http%3A%2F%2Fnginx.org%2Fen%2Fdownload.html","title":null},"content":[{"type":"text","text":"http://nginx.org/en/download.html"}]}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/89/893efa62e13635d953b5dead05761632.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢

  1. [front end -- JavaScript] knowledge point (IV) -- memory leakage in the project (I)
  2. This mechanism in JS
  3. Vue 3.0 source code learning 1 --- rendering process of components
  4. Learning the realization of canvas and simple drawing
  5. gin里获取http请求过来的参数
  6. vue3的新特性
  7. Get the parameters from HTTP request in gin
  8. New features of vue3
  9. vue-cli 引入腾讯地图(最新 api,rocketmq原理面试
  10. Vue 学习笔记(3,免费Java高级工程师学习资源
  11. Vue 学习笔记(2,Java编程视频教程
  12. Vue cli introduces Tencent maps (the latest API, rocketmq)
  13. Vue learning notes (3, free Java senior engineer learning resources)
  14. Vue learning notes (2, Java programming video tutorial)
  15. 【Vue】—props属性
  16. 【Vue】—创建组件
  17. [Vue] - props attribute
  18. [Vue] - create component
  19. 浅谈vue响应式原理及发布订阅模式和观察者模式
  20. On Vue responsive principle, publish subscribe mode and observer mode
  21. 浅谈vue响应式原理及发布订阅模式和观察者模式
  22. On Vue responsive principle, publish subscribe mode and observer mode
  23. Xiaobai can understand it. It only takes 4 steps to solve the problem of Vue keep alive cache component
  24. Publish, subscribe and observer of design patterns
  25. Summary of common content added in ES6 + (II)
  26. No.8 Vue element admin learning (III) vuex learning and login method analysis
  27. Write a mini webpack project construction tool
  28. Shopping cart (front-end static page preparation)
  29. Introduction to the fluent platform
  30. Webpack5 cache
  31. The difference between drop-down box select option and datalist
  32. CSS review (III)
  33. Node.js学习笔记【七】
  34. Node.js learning notes [VII]
  35. Vue Router根据后台数据加载不同的组件(思考->实现->不止于实现)
  36. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  37. 【JQuery框架,Java编程教程视频下载
  38. [jQuery framework, Java programming tutorial video download
  39. Vue Router根据后台数据加载不同的组件(思考->实现->不止于实现)
  40. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  41. 【Vue,阿里P8大佬亲自教你
  42. 【Vue基础知识总结 5,字节跳动算法工程师面试经验
  43. [Vue, Ali P8 teaches you personally
  44. [Vue basic knowledge summary 5. Interview experience of byte beating Algorithm Engineer
  45. 【问题记录】- 谷歌浏览器 Html生成PDF
  46. [problem record] - PDF generated by Google browser HTML
  47. 【问题记录】- 谷歌浏览器 Html生成PDF
  48. [problem record] - PDF generated by Google browser HTML
  49. 【JavaScript】查漏补缺 —数组中reduce()方法
  50. [JavaScript] leak checking and defect filling - reduce() method in array
  51. 【重识 HTML (3),350道Java面试真题分享
  52. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  53. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  54. [re recognize HTML (3) and share 350 real Java interview questions
  55. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  56. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  57. 【重识 HTML ,nginx面试题阿里
  58. 【重识 HTML (4),ELK原来这么简单
  59. [re recognize HTML, nginx interview questions]
  60. [re recognize HTML (4). Elk is so simple