{"id":568,"date":"2010-12-10T11:23:31","date_gmt":"2010-12-10T11:23:31","guid":{"rendered":""},"modified":"2010-12-10T11:23:31","modified_gmt":"2010-12-10T11:23:31","slug":"568","status":"publish","type":"post","link":"https:\/\/www.poloo.org\/?p=568","title":{"rendered":"nginx \u7684\u8d1f\u8f7d\u5747\u8861"},"content":{"rendered":"<p>nginx\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>Nginx (&#8220;engine x&#8221;) \u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684 HTTP \u548c \u53cd\u5411\u4ee3\u7406 \u670d\u52a1\u5668\uff0c\u4e5f\u662f\u4e00\u4e2a IMAP\/POP3\/SMTP \u4ee3\u7406\u670d\u52a1\u5668\u3002 Nginx \u662f\u7531 Igor Sysoev \u4e3a\u4fc4\u7f57\u65af\u8bbf\u95ee\u91cf\u7b2c\u4e8c\u7684 Rambler.ru \u7ad9\u70b9\u5f00\u53d1\u7684\uff0c\u5b83\u5df2\u7ecf\u5728\u8be5\u7ad9\u70b9\u8fd0\u884c\u8d85\u8fc7\u4e24\u5e74\u534a\u4e86\u3002Igor \u5c06\u6e90\u4ee3\u7801\u4ee5\u7c7bBSD\u8bb8\u53ef\u8bc1\u7684\u5f62\u5f0f\u53d1\u5e03\u3002\u5c3d\u7ba1\u8fd8\u662f\u6d4b\u8bd5\u7248\uff0c\u4f46\u662f\uff0cNginx \u5df2\u7ecf\u56e0\u4e3a\u5b83\u7684\u7a33\u5b9a\u6027\u3001\u4e30\u5bcc\u7684\u529f\u80fd\u96c6\u3001\u793a\u4f8b\u914d\u7f6e\u6587\u4ef6\u548c\u4f4e\u7cfb\u7edf\u8d44\u6e90\u7684\u6d88\u8017\u800c\u95fb\u540d\u4e86\u3002<\/p>\n<p>\u9996\u5148\u662f\u914d\u7f6e\u5341\u5206\u7684\u7b80\u5355\uff0c\u800c\u4e14\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u3002\u771f\u662f\u76f8\u89c1\u6068\u665a\u3002<br \/>\u5148\u6765\u770b\u770b\u914d\u7f6e\u6587\u4ef6\u600e\u4e48\u5199\u5427 <br \/>worker_processes 1;<br \/>events {<br \/>worker_connections 1024;<br \/>}<br \/>http{<br \/>upstream myproject {<br \/>#\u8fd9\u91cc\u6307\u5b9a\u591a\u4e2a\u6e90\u670d\u52a1\u5668\uff0cip:\u7aef\u53e3,80\u7aef\u53e3\u7684\u8bdd\u53ef\u5199\u53ef\u4e0d\u5199<br \/>server 192.168.43.158:80;<br \/>server 192.168.41.167;<br \/>}<\/p>\n<p>server {<br \/>listen 8080;<br \/>location \/ {<br \/>proxy_pass <a href=\"http:\/\/myproject\" target=\"_blank\" rel=\"external\">http:\/\/myproject<\/a>;<br \/>}<br \/>}<br \/>}<\/p>\n<p>nginx\u7684\u8d1f\u8f7d\u5747\u8861\u6709\u54ea\u4e9b\u529f\u80fd\u5462\uff1f<\/p>\n<ul><\/p>\n<li>\u5982\u679c\u540e\u9762\u7684\u670d\u52a1\u5668\u5176\u4e2d\u4e00\u53f0\u574f\u4e86\uff0c\u5b83\u80fd\u81ea\u52a8\u8bc6\u522b\uff0c\u66f4\u725b\u7684\u662f\u5b83\u597d\u4e86\u4e4b\u540enginx\u53ef\u4ee5\u9a6c\u4e0a\u8bc6\u522b<\/li>\n<li>\u670d\u52a1\u5668A\u548cB\uff0c\u5982\u679cA\u7684\u54cd\u5e94\u65f6\u95f4\u4e3a3\uff0cB\u7684\u54cd\u5e94\u65f6\u95f4\u4e3a1\uff0c\u90a3\u4e48nginx\u4f1a\u81ea\u52a8\u8c03\u6574\u8bbf\u95eeB\u7684\u6982\u7387\u662fA\u76843\u500d\uff0c\u771f\u6b63\u505a\u5230\u8d1f\u8f7d\u5747\u8861<\/li>\n<\/ul>\n<p>\u5728\u8fd9\u91cc\u8fd8\u662f\u60f3\u8bf4\u8bf4nginx\u7684\u5b89\u88c5\u53ca\u8fd0\u884c<br \/>\u5148\u5230<a href=\"http:\/\/www.nginx.net\/\" target=\"_blank\" rel=\"external\">http:\/\/www.nginx.net\/<\/a>\u4e0b\u8f7d\u6700\u65b0\u7684\u6e90\u7801\u5305\u3002<br \/>\u6211\u4e0b\u8f7d\u5230\u7684\u662fnginx-0.5.33.tar.gz<br \/>\u89e3\u538b\uff1atar zxvf nginx-0.5.33.tar.gz<br \/>\u63a5\u7740\uff1a.\/configure<br \/>\u518d\u63a5\u7740\uff1amake<br \/>\u6700\u540e\uff1amake install<br \/>\u597d\u7684\uff0c\u5b89\u88c5\u5b8c\u6210\u4e86\u3002\u6211\u5728make\u7684\u65f6\u5019\u62a5\u4e86\u4e2a\u9519\uff0c\u8bf4HTTP Rewrite \u6a21\u5757 \u6709\u95ee\u9898\uff0c\u6211\u5c31.\/configure &#8211;without-http_rewrite_module<br \/>\u7136\u540e\u518dmake,make install\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\u5b89\u88c5\u597d\u4e86\u4e4b\u540e\u65b0\u5efa\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u628a\u4e0a\u9762\u7684\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u62f7\u8fdb\u53bb\uff0c\u5f53\u7136\u8981\u4fee\u6539\u4f60\u7684IP\uff0c\u4fdd\u5b58\u4e3a\u6bd4\u5982 load_balance.conf<\/p>\n<p>\u7136\u540e\u542f\u52a8\uff1a<br \/>\/usr\/local\/nginx\/sbin\/nginx -c load_balence.conf<\/p>\n<p>\u5982\u679c\u4e0a\u9762\u7684\u6b65\u9aa4\u8d70\u4e0b\u6765\u6709\u95ee\u9898\u7684\u8bdd\uff0c\u53ef\u4ee5\u53c2\u8003\uff1a<br \/>nginx\u7684\u4e2d\u6587\u7ef4\u57fa<br \/><a href=\"http:\/\/wiki.codemongers.com\/NginxChs\" target=\"_blank\" rel=\"external\">http:\/\/wiki.codemongers.com\/NginxChs<\/a><br \/>\u5f53\u7136\u4e5f\u53ef\u4ee5\u5230\u5b98\u65b9\u7f51\u7ad9<br \/>www.nginx.net<br \/>www.nginx.com<\/p>\n<p>\u7531\u4e8enginx\u7684\u4f5c\u8005\u662f\u4fc4\u56fd\u4eba\uff0c\u6240\u4ee5\u82f1\u6587\u7684\u6587\u6863\u4e5f\u4e0d\u662f\u90a3\u4e48\u5b8c\u5584\uff0c\u5bf9\u4e8e\u6211\u6765\u8bf4nginx\u7684\u6700\u5927\u4f18\u70b9\u8fd8\u662f\u914d\u7f6e\u7b80\u5355\uff0c\u529f\u80fd\u5f3a\u5927<br \/>\u6211\u66fe\u7ecf\u914d\u8fc7 apache-jk,\u90a3\u771f\u7684\u4e0d\u662f\u4e00\u822c\u4eba\u80fd\u914d\u7684\u3002\u592a\u590d\u6742\u4e86\uff0c\u800c\u4e14\u53ea\u80fd\u7528\u6765\u505atomcat\u7684\u8d1f\u8f7d\u5747\u8861\u3002<br \/>nginx\u5c31\u6ca1\u6709\u8fd9\u4e2a\u9650\u5236\uff0c\u5bf9\u5b83\u6765\u8bf4\u540e\u9762\u662f\u4ec0\u4e48\u670d\u52a1\u5668\u662f\u5b8c\u5168\u900f\u540d\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>nginx\u662f\u4ec0\u4e48\uff1f Nginx (&#8220;engine x&#038;#&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-568","post","type-post","status-publish","format-standard","hentry","category-NetOS"],"_links":{"self":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=568"}],"version-history":[{"count":0,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/568\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}