{"id":194,"date":"2021-06-16T16:31:33","date_gmt":"2021-06-16T08:31:33","guid":{"rendered":"https:\/\/fugary.com\/?p=194"},"modified":"2021-06-16T16:31:33","modified_gmt":"2021-06-16T08:31:33","slug":"nginx%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fugary.com\/?p=194","title":{"rendered":"Nginx\u5b89\u88c5\u914d\u7f6e"},"content":{"rendered":"<h3>Nginx\u4ecb\u7ecd<\/h3>\n<p>Nginx\u662f\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u7684Web \u670d\u52a1\u5668\/\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\u53ca\u7535\u5b50\u90ae\u4ef6\uff08IMAP\/POP3\uff09\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u5728BSD-like \u534f\u8bae\u4e0b\u53d1\u884c\u3002\u5176\u7279\u70b9\u662f\u5360\u6709\u5185\u5b58\u5c11\uff0c\u5e76\u53d1\u80fd\u529b\u5f3a\uff0c\u4e8b\u5b9e\u4e0anginx\u7684\u5e76\u53d1\u80fd\u529b\u5728\u540c\u7c7b\u578b\u7684\u7f51\u9875\u670d\u52a1\u5668\u4e2d\u8868\u73b0\u8f83\u597d\uff0c\u4e2d\u56fd\u5927\u9646\u4f7f\u7528nginx\u7f51\u7ad9\u7528\u6237\u6709\uff1a\u767e\u5ea6\u3001\u4eac\u4e1c\u3001\u65b0\u6d6a\u3001\u7f51\u6613\u3001\u817e\u8baf\u3001\u6dd8\u5b9d\u7b49\u3002<\/p>\n<p>Nginx\u67b6\u6784\uff08\u591aworker\u8fdb\u7a0b\uff09<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210616153344.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210616153344.png\" alt=\"chapter-2-1\" \/><\/div><\/p>\n<h3>\u5b98\u65b9\u7f51\u7ad9<\/h3>\n<p>\u5b98\u7f51\uff1a<a href=\"http:\/\/nginx.org\/\">http:\/\/nginx.org\/<\/a><\/p>\n<p>\u5176\u4ed6\u4e2d\u6587\u7f51\u7ad9\uff1a<a href=\"https:\/\/www.nginx.org.cn\">https:\/\/www.nginx.org.cn<\/a><\/p>\n<p>\u6587\u6863\u5730\u5740\uff1a<a href=\"http:\/\/nginx.org\/en\/docs\/\">http:\/\/nginx.org\/en\/docs\/<\/a><\/p>\n<h3>\u5b89\u88c5Nginx<\/h3>\n<p>\u5b89\u88c5\u6587\u6863\uff1a<a href=\"http:\/\/nginx.org\/en\/linux_packages.html#RHEL-CentOS\">http:\/\/nginx.org\/en\/linux_packages.html#RHEL-CentOS<\/a><\/p>\n<p>\u5f53\u524d\u4ee5CentOS7\u73af\u5883\u4e3a\u4f8b\uff0c\u5b89\u88c5\u5b98\u65b9\u7f51\u7ad9\u6307\u5b9a\u7684\u65b9\u5f0f\u5b89\u88c5\u3002<\/p>\n<p>\u5148\u5b89\u88c5\u4e00\u4e9b\u524d\u7f6e\u9700\u6c42\uff1a<\/p>\n<pre><code class=\"language-sh\">sudo yum install yum-utils<\/code><\/pre>\n<p>\u6dfb\u52a0Nginx\u7684\u6e90\uff1a<\/p>\n<pre><code class=\"language-sh\">sudo vim \/etc\/yum.repos.d\/nginx.repo\n# \u586b\u5165\u5185\u5bb9\uff1a\n[nginx-stable]\nname=nginx stable repo\nbaseurl=http:\/\/nginx.org\/packages\/centos\/$releasever\/$basearch\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/nginx.org\/keys\/nginx_signing.key\nmodule_hotfixes=true\n\n[nginx-mainline]\nname=nginx mainline repo\nbaseurl=http:\/\/nginx.org\/packages\/mainline\/centos\/$releasever\/$basearch\/\ngpgcheck=1\nenabled=0\ngpgkey=https:\/\/nginx.org\/keys\/nginx_signing.key\nmodule_hotfixes=true<\/code><\/pre>\n<p>\u542f\u7528Nginx\u6e90\uff1a<\/p>\n<pre><code class=\"language-sh\">sudo yum-config-manager --enable nginx-mainline<\/code><\/pre>\n<p>\u5b89\u88c5Nginx<\/p>\n<pre><code class=\"language-sh\">sudo yum install nginx<\/code><\/pre>\n<h3>\u542f\u52a8\u5e76\u6d4b\u8bd5Nginx<\/h3>\n<p>\u73b0\u5728\u53ef\u4ee5\u542f\u52a8Nginx\u4e86\uff0c\u7136\u540e\u53ef\u4ee5\u8bbf\u95ee\u9ed8\u8ba4\u7684\u7f51\u9875<\/p>\n<pre><code class=\"language-sh\"># \u67e5\u770b\u5e2e\u52a9\nnginx -h\n# \u542f\u52a8\nsudo nginx\n# \u67e5\u770bnginx\u8fdb\u7a0b,\u53ef\u4ee5\u770b\u5230\u6709\u591a\u4e2a\u8fdb\u7a0b\uff0cnginx\u662f\u591a\u8fdb\u7a0b\u67b6\u6784\nps -ef|grep nginx\n# \u91cd\u542f\nnginx -s reload\n# \u505c\u6b62\nnginx -s stop<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u9ed8\u8ba4\u7684\u9996\u9875<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210616144114.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210616144114.png\" alt=\"image-20210616143550954\" \/><\/div><\/p>\n<h3>\u5e38\u89c1\u9519\u8bef<\/h3>\n<pre><code class=\"language-sh\">\u83b7\u53d6 GPG \u5bc6\u94a5\u5931\u8d25\uff1a[Errno 14] curl#35 - &quot;Peer reports incompatible or unsupported protocol version.&quot;<\/code><\/pre>\n<p>\u4ece\u6d88\u606f\u770b\u8fd9\u4e2a\u9519\u8bef\u662fcurl\u83b7\u53d6PGP key\u7684\u65f6\u5019\u62a5\u9519\uff0c\u4e0d\u652f\u6301\u534f\u8bae\u53f7\uff0c\u5730\u5740\uff08<code>https:\/\/nginx.org\/keys\/nginx_signing.key<\/code>\uff09\u8bbf\u95ee\u662f\u53ef\u4ee5\u7684\uff0c\u53ef\u80fd\u662fcurl\u7248\u672c\u8fc7\u4f4e\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u662f\u5347\u7ea7\u4e0bcurl\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u4e86<\/p>\n<pre><code class=\"language-sh\">sudo yum install curl<\/code><\/pre>\n<h3>\u914d\u7f6e\u4ee3\u7406<\/h3>\n<p>\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u5730\u5740\uff1a\/etc\/nginx\/nginx.conf<\/p>\n<p>\u9ed8\u8ba4\u4e3b\u9875\u76ee\u5f55\uff1a\/usr\/share\/nginx\/html\/<\/p>\n<p>\u76ee\u524d\u9700\u8981\u914d\u7f6e\u4e00\u4e2a\u7b2c\u4e09\u65b9\u670d\u52a1\u5668\u7684\u4ee3\u7406\u670d\u52a1\uff1a<\/p>\n<p>\u5728http\u8282\u70b9\u4e0b\u9762\u6dfb\u52a0\uff1a<\/p>\n<pre><code class=\"language-nginx\">http {\n    server {\n        location \/booking\/ {\n            proxy_pass https:\/\/xxx\/bookingusb\/v4\/;\n        }\n\n        location \/shopping\/ {\n            proxy_pass https:\/\/xxx\/shoppingengine\/v4\/;\n        }\n    }\n}<\/code><\/pre>\n<p>\u6ce8\u610f\uff0c\u5982\u679c\u52a0\u5230\u6587\u4ef6\u672b\u5c3e\u4f4d\u7f6e\u6ca1\u6709\u6548\u679c\uff0c\u53ef\u4ee5\u5c1d\u8bd5\uff1a<\/p>\n<ol>\n<li>\u66f4\u6362\u76d1\u542c\u7aef\u53e3listen 8000<\/li>\n<li>\u53bb\u6389\u9ed8\u8ba4server\u914d\u7f6e\uff1a<code>include \/etc\/nginx\/conf.d\/*.conf;<\/code> \u6216\u8005\u76f4\u63a5\u5728\u9ed8\u8ba4\u914d\u7f6e\u4e2d\u6dfb\u52a0<\/li>\n<li>\u6dfb\u52a0\u5230<code>include \/etc\/nginx\/conf.d\/*.conf;<\/code>\u8fd9\u884c\u4e4b\u524d<\/li>\n<\/ol>\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u6d4b\u8bd5\u8bbf\u95ee\u4e86\u3002<\/p>\n<h3>\u5176\u4ed6\u5de5\u5177<\/h3>\n<p>\u5728\u7ebfnginx\u914d\u7f6e\u5de5\u5177\uff1a<a href=\"https:\/\/www.nginxedit.cn\/\">https:\/\/www.nginxedit.cn\/<\/a><\/p>\n<p>nginx\u6559\u7a0b\uff1a<a href=\"https:\/\/www.w3cschool.cn\/nginx\/ycn81k97.html\">https:\/\/www.w3cschool.cn\/nginx\/ycn81k97.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nginx\u4ecb\u7ecd Nginx\u662f\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u7684Web \u670d\u52a1\u5668\/\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\u53ca\u7535\u5b50\u90ae\u4ef6\uff08IMAP\/POP3\uff09\u4ee3\u7406\u670d\u52a1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[40],"_links":{"self":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/194"}],"collection":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":1,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions\/195"}],"wp:attachment":[{"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}