{"id":84,"date":"2010-05-20T19:42:10","date_gmt":"2010-05-20T19:42:10","guid":{"rendered":"68d30a9594728bc39aa24be94b319d21"},"modified":"2010-05-20T19:42:10","modified_gmt":"2010-05-20T19:42:10","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/84","title":{"rendered":"nginx\u8d1f\u8f7d\u5747\u8861"},"content":{"rendered":"<div>\n<div>Nginx (\"engine x\") \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<\/div>\n<\/div>\n<p>\n\u9996\u5148\u662f\u914d\u7f6e\u5341\u5206\u7684\u7b80\u5355\uff0c\u800c\u4e14\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u3002<\/p>\n<p>\nworker_processes 1;<br \/>\nevents {<br \/>\nworker_connections 1024;<br \/>\n}<br \/>\nhttp{<br \/>\nupstream myproject {<br \/>\n#\u8fd9\u91cc\u6307\u5b9a\u591a\u4e2a\u6e90\u670d\u52a1\u5668\uff0cip:\u7aef\u53e3,80\u7aef\u53e3\u7684\u8bdd\u53ef\u5199\u53ef\u4e0d\u5199<br \/>\nserver 192.168.43.158:80;<br \/>\nserver 192.168.41.167;<br \/>\n}<\/p>\n<p>server {<br \/>\nlisten 8080;<br \/>\nlocation \/ {<br \/>\nproxy_pass http:\/\/myproject;<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>nginx\u7684\u8d1f\u8f7d\u5747\u8861\u6709\u54ea\u4e9b\u529f\u80fd\u5462\uff1f<br \/>\n&nbsp;<\/p>\n<ul>\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 \/>\n\u5148\u5230http:\/\/www.nginx.net\/\u4e0b\u8f7d\u6700\u65b0\u7684\u6e90\u7801\u5305\u3002<br \/>\n\u6211\u4e0b\u8f7d\u5230\u7684\u662fnginx-0.5.33.tar.gz<br \/>\n\u89e3\u538b\uff1atar zxvf nginx-0.5.33.tar.gz<br \/>\n\u63a5\u7740\uff1a.\/configure<br \/>\n\u518d\u63a5\u7740\uff1amake<br \/>\n\u6700\u540e\uff1amake install<br \/>\n\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 --without-http_rewrite_module <br \/>\n\u7136\u540e\u518dmake,make install\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\n\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 \/>\n\/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 \/>\nnginx\u7684\u4e2d\u6587\u7ef4\u57fa<br \/>\nhttp:\/\/wiki.codemongers.com\/NginxChs<br \/>\n\u5f53\u7136\u4e5f\u53ef\u4ee5\u5230\u5b98\u65b9\u7f51\u7ad9<br \/>\nwww.nginx.net<br \/>\nwww.nginx.com<br \/>\n-------------------------------------------------------------------------------------------------------<br \/>\n&nbsp;<\/p>\n<p class=\"xspace-smalltxt\">\u4e00\u3001) \u5b89\u88c5<a href=\"http:\/\/hi.baidu.com\/zhangdiandong\/blog\/item\/:;\" target=\"_blank\">Nginx<\/a> <br \/>\n1.) \u5b89\u88c5<br \/>\nNginx\u53d1\u97f3\u4e3a[engine x]\uff0c\u662f\u7531\u4fc4\u7f57\u65af\u4ebaIgor Sysoev\u5efa\u7acb\u7684\u9879\u76ee,\u57fa\u4e8eBSD\u8bb8\u53ef\u3002\u636e\u8bf4\u4ed6\u5f53\u521d\u662fF5\u7684\u6210\u5458\u4e4b\u4e00\uff0c\u82f1\u6587\u4e3b\u9875\uff1a<a href=\"http:\/\/nginx.net\/\" target=\"_blank\">http:\/\/nginx.net<\/a> \u3002\u4fc4\u7f57\u65af\u7684\u4e00\u4e9b\u5927\u7f51\u7ad9\u5df2\u7ecf\u4f7f\u7528\u5b83\u8d85\u8fc7\u4e24\u5e74\u591a\u4e86\uff0c\u4e00\u76f4\u8868\u73b0\u4e0d\u51e1\u3002<br \/>\nNginx\u7684\u7f16\u8bd1\u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n<p class=\"xspace-smalltxt\">\n<p class=\"xspace-smalltxt\">.\/configure --prefix=\/usr\/local\/nginx \\<\/p>\n<p class=\"xspace-smalltxt\">--user=apache \\<\/p>\n<p class=\"xspace-smalltxt\">--group=apache \\<\/p>\n<p class=\"xspace-smalltxt\">--with-http_ssl_module \\<\/p>\n<p class=\"xspace-smalltxt\">--with-http_gzip_static_module;<\/p>\n<p class=\"xspace-smalltxt\">\n<div class=\"xspace-itemmessage\">\n<pre>[root@localhost]#.\/configure --prefix=\/usr\/local\/server\/nginx --with-openssl=\/usr\/include \\\r\n--with-pcre=\/usr\/include\/pcre\/ --with-http_stub_status_module --without-http_memcached_module \\\r\n--without-http_fastcgi_module --without-http_rewrite_module --without-http_map_module \\\r\n--without-http_geo_module --without-http_autoindex_module<\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u9700\u8981\u8bf4\u660e\u4e00\u4e0b\uff0c\u7531\u4e8eNginx\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6211\u60f3\u7528\u5230\u6b63\u5219\uff0c\u6240\u4ee5\u9700\u8981pcre\u6a21\u5757\u7684\u652f\u6301\u3002\u6211\u5df2\u7ecf\u5b89\u88c5\u4e86pcre\u53capcre-devel\u7684rpm\u5305\uff0c\u4f46\u662f Ngxin \u5e76\u4e0d\u80fd\u6b63\u786e\u627e\u5230 .h\/.so\/.a\/.la \u6587\u4ef6\uff0c\u56e0\u6b64\u6211\u7a0d\u5fae\u53d8\u901a\u4e86\u4e00\u4e0b\uff1a<\/p>\n<pre>[root@localhost]#mkdir \/usr\/include\/pcre\/.libs\/\r\n[root@localhost]#cp \/usr\/lib\/libpcre.a \/usr\/include\/pcre\/.libs\/libpcre.a\r\n[root@localhost]#cp \/usr\/lib\/libpcre.a \/usr\/include\/pcre\/.libs\/libpcre.la<\/pre>\n<p>\u7136\u540e\uff0c\u4fee\u6539objs\/Makefile\u5927\u6982\u5728908\u884c\u7684\u4f4d\u7f6e\u4e0a\uff0c\u6ce8\u91ca\u6389\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>.\/configure --disable-shared<\/pre>\n<p>\u63a5\u4e0b\u6765\uff0c\u5c31\u53ef\u4ee5\u6b63\u5e38\u6267\u884cmake\u53camake install\u4e86\u3002<\/p>\n<p>2.) \u4fee\u6539\u914d\u7f6e\u6587\u4ef6\/usr\/local\/server\/nginx\/conf\/nginx.conf<br \/>\n\u4ee5\u4e0b\u662f\u6211\u7684nginx.conf\u5185\u5bb9\uff0c\u4ec5\u4f9b\u53c2\u8003\uff1a<\/p>\n<pre>#\u8fd0\u884c\u7528\u6237\r\nuser  nobody nobody;\r\n\r\n#\u542f\u52a8\u8fdb\u7a0b\r\nworker_processes  2;\r\n\r\n#\u5168\u5c40\u9519\u8bef\u65e5\u5fd7\u53caPID\u6587\u4ef6\r\nerror_log  logs\/error.log notice;\r\npid        logs\/nginx.pid;\r\n\r\n#\u5de5\u4f5c\u6a21\u5f0f\u53ca\u8fde\u63a5\u6570\u4e0a\u9650\r\nevents {\r\n        use epoll;\r\n        worker_connections      1024;\r\n}\r\n\r\n#\u8bbe\u5b9ahttp\u670d\u52a1\u5668\uff0c\u5229\u7528\u5b83\u7684\u53cd\u5411\u4ee3\u7406\u529f\u80fd\u63d0\u4f9b<a href=\"http:\/\/hi.baidu.com\/zhangdiandong\/blog\/item\/:;\" target=\"_blank\">\u8d1f\u8f7d<\/a> \u5747\u8861\u652f\u6301\r\nhttp {\r\n        #\u8bbe\u5b9amime\u7c7b\u578b\r\n        include       conf\/mime.types;\r\n        default_type  application\/octet-stream;\r\n\r\n        #\u8bbe\u5b9a\u65e5\u5fd7\u683c\u5f0f\r\n        log_format main         '$remote_addr - $remote_user [$time_local] '\r\n                                                '\"$request\" $status $bytes_sent '\r\n                                                '\"$http_referer\" \"$http_user_agent\" '\r\n                                                '\"$gzip_ratio\"';\r\n\r\n        log_format download '$remote_addr - $remote_user [$time_local] '\r\n                                                '\"$request\" $status $bytes_sent '\r\n                                                '\"$http_referer\" \"$http_user_agent\" '\r\n                                                '\"$http_range\" \"$sent_http_content_range\"';\r\n\r\n        #\u8bbe\u5b9a\u8bf7\u6c42\u7f13\u51b2\r\n        client_header_buffer_size    1k;\r\n        large_client_header_buffers  4 4k;\r\n\r\n        #\u5f00\u542fgzip\u6a21\u5757\r\n        gzip on;\r\n        gzip_min_length  1100;\r\n        gzip_buffers     4 8k;\r\n        gzip_types       text\/plain;\r\n\r\n        output_buffers   1 32k;\r\n        postpone_output  1460;\r\n\r\n        #\u8bbe\u5b9aaccess log\r\n        access_log  logs\/access.log  main;\r\n\r\n        client_header_timeout  3m;\r\n        client_body_timeout    3m;\r\n        send_timeout           3m;\r\n\r\n        sendfile                on;\r\n        tcp_nopush              on;\r\n        tcp_nodelay             on;\r\n\r\n        keepalive_timeout  65;\r\n\r\n        #\u8bbe\u5b9a\u8d1f\u8f7d\u5747\u8861\u7684\u670d\u52a1\u5668\u5217\u8868\r\n        upstream mysvr {\r\n                #weigth\u53c2\u6570\u8868\u793a\u6743\u503c\uff0c\u6743\u503c\u8d8a\u9ad8\u88ab\u5206\u914d\u5230\u7684\u51e0\u7387\u8d8a\u5927\r\n                #\u672c\u673a\u4e0a\u7684Squid\u5f00\u542f3128\u7aef\u53e3\r\n                server 192.168.8.1:3128 weight=5;\r\n                server 192.168.8.2:80   weight=1;\r\n                server 192.168.8.3:80   weight=6;\r\n        }\r\n\r\n        #\u8bbe\u5b9a\u865a\u62df\u4e3b\u673a\r\n        server {\r\n                listen          80;\r\n                server_name     192.168.8.1 www.yejr.com;\r\n\r\n                charset gb2312;\r\n\r\n                #\u8bbe\u5b9a\u672c\u865a\u62df\u4e3b\u673a\u7684\u8bbf\u95ee\u65e5\u5fd7\r\n                access_log  logs\/www.yejr.com.access.log  main;\r\n\r\n                #\u5982\u679c\u8bbf\u95ee \/img\/*, \/js\/*, \/css\/* \u8d44\u6e90\uff0c\u5219\u76f4\u63a5\u53d6\u672c\u5730\u6587\u4ef6\uff0c\u4e0d\u901a\u8fc7squid\r\n                #\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u8f83\u591a\uff0c\u4e0d\u63a8\u8350\u8fd9\u79cd\u65b9\u5f0f\uff0c\u56e0\u4e3a\u901a\u8fc7squid\u7684\u7f13\u5b58\u6548\u679c\u66f4\u597d\r\n                location ~ ^\/(img|js|css)\/  {\r\n                        root    \/data3\/Html;\r\n                        expires 24h;\r\n                }\r\n\r\n                #\u5bf9 \"\/\" \u542f\u7528\u8d1f\u8f7d\u5747\u8861\r\n                location \/ {\r\n                        proxy_pass      http:\/\/mysvr;\r\n\r\n                        proxy_redirect          off;\r\n                        proxy_set_header        Host $host;\r\n                        proxy_set_header        X-Real-IP $remote_addr;\r\n                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;\r\n                        client_max_body_size    10m;\r\n                        client_body_buffer_size 128k;\r\n                        proxy_connect_timeout   90;\r\n                        proxy_send_timeout      90;\r\n                        proxy_read_timeout      90;\r\n                        proxy_buffer_size       4k;\r\n                        proxy_buffers           4 32k;\r\n                        proxy_busy_buffers_size 64k;\r\n                        proxy_temp_file_write_size 64k;\r\n                }\r\n\r\n                #\u8bbe\u5b9a\u67e5\u770bNginx\u72b6\u6001\u7684\u5730\u5740\r\n                location \/NginxStatus {\r\n                        stub_status             on;\r\n                        access_log              on;\r\n                        auth_basic              \"NginxStatus\";\r\n                        auth_basic_user_file  conf\/htpasswd;\r\n                }\r\n        }\r\n}<\/pre>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u68c0\u6d4b\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u65e0\u8bef\uff1a<\/p>\n<pre>\u5982\u679c\u6ca1\u6709\u62a5\u9519\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u5f00\u59cb\u8fd0\u884cNginx\u4e86\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\uff1a<\/pre>\n<pre>\u5907\u6ce8\uff1aconf\/htpasswd \u6587\u4ef6\u7684\u5185\u5bb9\u7528 apache \u63d0\u4f9b\u7684 htpasswd \u5de5\u5177\u6765\u4ea7\u751f\u5373\u53ef\uff0c\u5185\u5bb9\u5927\u81f4\u5982\u4e0b\uff1a<\/pre>\n<pre>3.) \u67e5\u770b Nginx \u8fd0\u884c\u72b6\u6001\r\n  \u8f93\u5165\u5730\u5740 http:\/\/192.168.8.1\/NginxStatus\/\uff0c\u8f93\u5165\u9a8c\u8bc1\u5e10\u53f7\u5bc6\u7801\uff0c\u5373\u53ef\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u5185\u5bb9\uff1a<\/pre>\n<pre>Active connections: 328\r\nserver accepts handled requests\r\n9309 8982 28890\r\nReading: 1 Writing: 3 Waiting: 324<\/pre>\n<p>\u7b2c\u4e00\u884c\u8868\u793a\u76ee\u524d\u6d3b\u8dc3\u7684\u8fde\u63a5\u6570 \u7b2c\u4e09\u884c\u7684\u7b2c\u4e09\u4e2a\u6570\u5b57\u8868\u793aNginx\u8fd0\u884c\u5230\u5f53\u524d\u65f6\u95f4\u63a5\u53d7\u5230\u7684\u603b\u8bf7\u6c42\u6570\uff0c\u5982\u679c\u5feb\u8fbe\u5230\u4e86\u4e0a\u9650\uff0c\u5c31\u9700\u8981\u52a0\u5927\u4e0a\u9650\u503c\u4e86\u3002 <\/p><\/div>\n<div class=\"xspace-itemmessage\">&nbsp;<\/div>\n<div class=\"xspace-itemmessage\">&nbsp;<\/div>\n<div class=\"xspace-itemmessage\">&nbsp;<\/div>\n<div class=\"xspace-itemmessage\"><strong>\u5176\u5b83\uff1a<\/strong><\/div>\n<div class=\"xspace-itemmessage\">\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">Nginx\u8d1f\u8f7d\u5747\u8861\u4e00\u4e9b\u57fa\u7840\u77e5\u8bc6:<\/p>\n<blockquote style=\"background-image:none;border-bottom:#efefef 2px solid;border-left:#efefef 2px solid;padding-bottom:5px;widows:2;text-transform:none;background-color:#ffffff;margin-top:10px;text-indent:0px;padding-left:10px;letter-spacing:normal;padding-right:10px;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;margin-bottom:10px;color:#333333;margin-left:25px;border-top:#efefef 2px solid;border-right:#efefef 2px solid;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">nginx \u7684 upstream\u76ee\u524d\u652f\u6301 4 \u79cd\u65b9\u5f0f\u7684\u5206\u914d<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n1)\u3001\u8f6e\u8be2\uff08\u9ed8\u8ba4\uff09<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u6bcf\u4e2a\u8bf7\u6c42\u6309\u65f6\u95f4\u987a\u5e8f\u9010\u4e00\u5206\u914d\u5230\u4e0d\u540c\u7684\u540e\u7aef\u670d\u52a1\u5668\uff0c\u5982\u679c\u540e\u7aef\u670d\u52a1\u5668down\u6389\uff0c\u80fd\u81ea\u52a8\u5254\u9664\u3002<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n2)\u3001weight<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u6307\u5b9a\u8f6e\u8be2\u51e0\u7387\uff0cweight\u548c\u8bbf\u95ee\u6bd4\u7387\u6210\u6b63\u6bd4\uff0c\u7528\u4e8e\u540e\u7aef\u670d\u52a1\u5668\u6027\u80fd\u4e0d\u5747\u7684\u60c5\u51b5\u3002<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n2)\u3001ip_hash<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u6bcf\u4e2a\u8bf7\u6c42\u6309\u8bbf\u95eeip\u7684hash\u7ed3\u679c\u5206\u914d\uff0c\u8fd9\u6837\u6bcf\u4e2a\u8bbf\u5ba2\u56fa\u5b9a\u8bbf\u95ee\u4e00\u4e2a\u540e\u7aef\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u89e3\u51b3session\u7684\u95ee\u9898\u3002&nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n3)\u3001fair\uff08\u7b2c\u4e09\u65b9\uff09<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u6309\u540e\u7aef\u670d\u52a1\u5668\u7684\u54cd\u5e94\u65f6\u95f4\u6765\u5206\u914d\u8bf7\u6c42\uff0c\u54cd\u5e94\u65f6\u95f4\u77ed\u7684\u4f18\u5148\u5206\u914d\u3002&nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n4)\u3001url_hash\uff08\u7b2c\u4e09\u65b9\uff09<\/p>\n<\/blockquote>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u914d\u7f6e\uff1a<\/p>\n<blockquote style=\"background-image:none;border-bottom:#efefef 2px solid;border-left:#efefef 2px solid;padding-bottom:5px;widows:2;text-transform:none;background-color:#ffffff;margin-top:10px;text-indent:0px;padding-left:10px;letter-spacing:normal;padding-right:10px;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;margin-bottom:10px;color:#333333;margin-left:25px;border-top:#efefef 2px solid;border-right:#efefef 2px solid;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\"><span style=\"line-height:19px;color:#4b4b4b;\">\u5728http\u8282\u70b9\u91cc\u6dfb\u52a0:<\/span><\/p>\n<p>#\u5b9a\u4e49\u8d1f\u8f7d\u5747\u8861\u8bbe\u5907\u7684 Ip\u53ca\u8bbe\u5907\u72b6\u6001<span class=\"Apple-converted-space\">&nbsp;<\/span><\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">upstream myServer {&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">&nbsp;&nbsp;&nbsp; server 127.0.0.1:9090 down;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp; server 127.0.0.1:8080 weight=2;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp; server 127.0.0.1:6060;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;&nbsp;&nbsp; server 127.0.0.1:7070 backup;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n}<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u5728\u9700\u8981\u4f7f\u7528\u8d1f\u8f7d\u7684Server\u8282\u70b9\u4e0b\u6dfb\u52a0<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">proxy_pass<span class=\"Apple-converted-space\">&nbsp;<\/span><a style=\"color:#1a8bc8;text-decoration:none;\" href=\"http:\/\/myserver%3b\/\">http:\/\/myServer;<\/a><\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">upstream \u6bcf\u4e2a\u8bbe\u5907\u7684\u72b6\u6001:<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">down \u8868\u793a\u5355\u524d\u7684server\u6682\u65f6\u4e0d\u53c2\u4e0e\u8d1f\u8f7d<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\nweight&nbsp; \u9ed8\u8ba4\u4e3a1.weight\u8d8a\u5927\uff0c\u8d1f\u8f7d\u7684\u6743\u91cd\u5c31\u8d8a\u5927\u3002<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\nmax_fails \uff1a\u5141\u8bb8\u8bf7\u6c42\u5931\u8d25\u7684\u6b21\u6570\u9ed8\u8ba4\u4e3a1.\u5f53\u8d85\u8fc7\u6700\u5927\u6b21\u6570\u65f6\uff0c\u8fd4\u56deproxy_next_upstream \u6a21\u5757\u5b9a\u4e49\u7684\u9519\u8bef<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\nfail_timeout:max_fails \u6b21\u5931\u8d25\u540e\uff0c\u6682\u505c\u7684\u65f6\u95f4\u3002<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\nbackup\uff1a \u5176\u5b83\u6240\u6709\u7684\u975ebackup\u673a\u5668down\u6216\u8005\u5fd9\u7684\u65f6\u5019\uff0c\u8bf7\u6c42backup\u673a\u5668\u3002\u6240\u4ee5\u8fd9\u53f0\u673a\u5668\u538b\u529b\u4f1a\u6700\u8f7b\u3002<\/p>\n<\/blockquote>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">Nginx\u8fd8\u652f\u6301\u591a\u7ec4\u7684\u8d1f\u8f7d\u5747\u8861,\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2aupstream&nbsp; \u6765\u670d\u52a1\u4e8e\u4e0d\u540c\u7684Server.<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u914d\u7f6e\u8d1f\u8f7d\u5747\u8861\u6bd4\u8f83\u7b80\u5355,\u4f46\u662f\u6700\u5173\u952e\u7684\u4e00\u4e2a\u95ee\u9898\u662f\u600e\u4e48\u5b9e\u73b0\u591a\u53f0\u670d\u52a1\u5668\u4e4b\u95f4session\u7684\u5171\u4eab<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u4e0b\u9762\u6709\u51e0\u79cd\u65b9\u6cd5(\u4ee5\u4e0b\u5185\u5bb9\u6765\u6e90\u4e8e\u7f51\u7edc,\u7b2c\u56db\u79cd\u65b9\u6cd5\u6ca1\u6709\u5b9e\u8df5.)<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">1) \u4e0d\u4f7f\u7528session\uff0c\u6362\u4f5ccookie<\/p>\n<blockquote style=\"background-image:none;border-bottom:#efefef 2px solid;border-left:#efefef 2px solid;padding-bottom:5px;widows:2;text-transform:none;background-color:#ffffff;margin-top:10px;text-indent:0px;padding-left:10px;letter-spacing:normal;padding-right:10px;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;margin-bottom:10px;color:#333333;margin-left:25px;border-top:#efefef 2px solid;border-right:#efefef 2px solid;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u80fd\u628asession\u6539\u6210cookie\uff0c\u5c31\u80fd\u907f\u5f00session\u7684\u4e00\u4e9b\u5f0a\u7aef\uff0c\u5728\u4ece\u524d\u770b\u7684\u4e00\u672cJ2EE\u7684\u4e66\u4e0a\uff0c\u4e5f\u6307\u660e\u5728\u96c6\u7fa4\u7cfb\u7edf\u4e2d\u4e0d\u80fd\u7528session\uff0c\u5426\u5219\u60f9\u51fa\u7978\u7aef\u6765\u5c31\u4e0d\u597d\u529e\u3002\u5982\u679c\u7cfb\u7edf\u4e0d\u590d\u6742\uff0c\u5c31\u4f18\u5148\u8003\u8651\u80fd\u5426\u5c06session\u53bb\u6389\uff0c\u6539\u52a8\u8d77\u6765\u975e\u5e38\u9ebb\u70e6\u7684\u8bdd\uff0c\u518d\u7528\u4e0b\u9762\u7684\u529e\u6cd5\u3002<\/p>\n<\/blockquote>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">2) \u5e94\u7528\u670d\u52a1\u5668\u81ea\u884c\u5b9e\u73b0\u5171\u4eab<\/p>\n<blockquote style=\"background-image:none;border-bottom:#efefef 2px solid;border-left:#efefef 2px solid;padding-bottom:5px;widows:2;text-transform:none;background-color:#ffffff;margin-top:10px;text-indent:0px;padding-left:10px;letter-spacing:normal;padding-right:10px;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;margin-bottom:10px;color:#333333;margin-left:25px;border-top:#efefef 2px solid;border-right:#efefef 2px solid;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">asp.net\u53ef\u4ee5\u7528\u6570\u636e\u5e93\u6216memcached\u6765\u4fdd\u5b58session\uff0c\u4ece\u800c\u5728asp.net\u672c\u8eab\u5efa\u7acb\u4e86\u4e00\u4e2asession\u96c6\u7fa4\uff0c\u7528\u8fd9\u6837\u7684\u65b9\u5f0f\u53ef\u4ee5\u4ee4 session\u4fdd\u8bc1\u7a33\u5b9a\uff0c\u5373\u4f7f\u67d0\u4e2a\u8282\u70b9\u6709\u6545\u969c\uff0csession\u4e5f\u4e0d\u4f1a\u4e22\u5931\uff0c\u9002\u7528\u4e8e\u8f83\u4e3a\u4e25\u683c\u4f46\u8bf7\u6c42\u91cf\u4e0d\u9ad8\u7684\u573a\u5408\u3002\u4f46\u662f\u5b83\u7684\u6548\u7387\u662f\u4e0d\u4f1a\u5f88\u9ad8\u7684\uff0c\u4e0d\u9002\u7528\u4e8e\u5bf9\u6548\u7387 \u8981\u6c42\u9ad8\u7684\u573a\u5408\u3002<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u4ee5\u4e0a\u4e24\u4e2a\u529e\u6cd5\u90fd\u8ddfnginx\u6ca1\u4ec0\u4e48\u5173\u7cfb\uff0c\u4e0b\u9762\u6765\u8bf4\u8bf4\u7528nginx\u8be5\u5982\u4f55\u5904\u7406\uff1a<\/p>\n<\/blockquote>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">3) ip_hash<\/p>\n<blockquote style=\"background-image:none;border-bottom:#efefef 2px solid;border-left:#efefef 2px solid;padding-bottom:5px;widows:2;text-transform:none;background-color:#ffffff;margin-top:10px;text-indent:0px;padding-left:10px;letter-spacing:normal;padding-right:10px;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;margin-bottom:10px;color:#333333;margin-left:25px;border-top:#efefef 2px solid;border-right:#efefef 2px solid;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">nginx\u4e2d\u7684ip_hash\u6280\u672f\u80fd\u591f\u5c06\u67d0\u4e2aip\u7684\u8bf7\u6c42\u5b9a\u5411\u5230\u540c\u4e00\u53f0\u540e\u7aef\uff0c\u8fd9\u6837\u4e00\u6765\u8fd9\u4e2aip\u4e0b\u7684\u67d0\u4e2a\u5ba2\u6237\u7aef\u548c\u67d0\u4e2a\u540e\u7aef\u5c31\u80fd\u5efa\u7acb\u8d77\u7a33\u56fa\u7684session\uff0cip_hash\u662f\u5728upstream\u914d\u7f6e\u4e2d\u5b9a\u4e49\u7684\uff1a<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">upstream backend {<br \/>\n&nbsp; server 127.0.0.1:8080 ;<br \/>\n&nbsp; server 127.0.0.1:9090 ;<br \/>\n&nbsp;&nbsp; ip_hash;<br \/>\n}<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">ip_hash\u662f\u5bb9\u6613\u7406\u89e3\u7684\uff0c\u4f46\u662f\u56e0\u4e3a\u4ec5\u4ec5\u80fd\u7528ip\u8fd9\u4e2a\u56e0\u5b50\u6765\u5206\u914d\u540e\u7aef\uff0c\u56e0\u6b64ip_hash\u662f\u6709\u7f3a\u9677\u7684\uff0c\u4e0d\u80fd\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\u4f7f\u7528\uff1a<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">1\/ nginx\u4e0d\u662f\u6700\u524d\u7aef\u7684\u670d\u52a1\u5668\u3002ip_hash\u8981\u6c42nginx\u4e00\u5b9a\u662f\u6700\u524d\u7aef\u7684\u670d\u52a1\u5668\uff0c\u5426\u5219nginx\u5f97\u4e0d\u5230\u6b63\u786eip\uff0c\u5c31\u4e0d\u80fd\u6839\u636eip\u4f5chash\u3002\u8b6c\u5982\u4f7f\u7528\u7684\u662fsquid\u4e3a\u6700\u524d\u7aef\uff0c\u90a3\u4e48nginx\u53d6ip\u65f6\u53ea\u80fd\u5f97\u5230squid\u7684\u670d\u52a1\u5668ip\u5730\u5740\uff0c\u7528\u8fd9\u4e2a\u5730\u5740\u6765\u4f5c\u5206\u6d41\u662f\u80af\u5b9a\u9519\u4e71\u7684\u3002<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">2\/ nginx\u7684\u540e\u7aef\u8fd8\u6709\u5176\u5b83\u65b9\u5f0f\u7684\u8d1f\u8f7d\u5747\u8861\u3002\u5047\u5982nginx\u540e\u7aef\u53c8\u6709\u5176\u5b83\u8d1f\u8f7d\u5747\u8861\uff0c\u5c06\u8bf7\u6c42\u53c8\u901a\u8fc7\u53e6\u5916\u7684\u65b9\u5f0f\u5206\u6d41\u4e86\uff0c\u90a3\u4e48\u67d0\u4e2a\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u80af\u5b9a\u4e0d\u80fd\u5b9a\u4f4d\u5230\u540c\u4e00\u53f0session\u5e94\u7528\u670d\u52a1\u5668\u4e0a\u3002\u8fd9\u4e48\u7b97\u8d77\u6765\uff0cnginx\u540e\u7aef\u53ea\u80fd\u76f4\u63a5\u6307\u5411\u5e94\u7528\u670d\u52a1\u5668\uff0c\u6216\u8005\u518d\u642d\u4e00\u4e2asquid\uff0c\u7136\u540e\u6307\u5411\u5e94\u7528\u670d\u52a1\u5668\u3002\u6700\u597d\u7684\u529e\u6cd5\u662f\u7528location\u4f5c\u4e00\u6b21\u5206\u6d41\uff0c\u5c06\u9700\u8981session\u7684\u90e8\u5206\u8bf7\u6c42\u901a\u8fc7ip_hash\u5206\u6d41\uff0c\u5269\u4e0b\u7684\u8d70\u5176\u5b83\u540e\u7aef\u53bb\u3002<\/p>\n<\/blockquote>\n<p style=\"widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:10px auto;letter-spacing:normal;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#4b4b4b;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">4) upstream_hash<\/p>\n<blockquote style=\"background-image:none;border-bottom:#efefef 2px solid;border-left:#efefef 2px solid;padding-bottom:5px;widows:2;text-transform:none;background-color:#ffffff;margin-top:10px;text-indent:0px;padding-left:10px;letter-spacing:normal;padding-right:10px;font:13px\/19px Verdana, Geneva, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;margin-bottom:10px;color:#333333;margin-left:25px;border-top:#efefef 2px solid;border-right:#efefef 2px solid;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u4e3a\u4e86\u89e3\u51b3ip_hash\u7684\u4e00\u4e9b\u95ee\u9898\uff0c\u53ef\u4ee5\u4f7f\u7528upstream_hash\u8fd9\u4e2a\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u8fd9\u4e2a\u6a21\u5757\u591a\u6570\u60c5\u51b5\u4e0b\u662f\u7528\u4f5curl_hash\u7684\uff0c\u4f46\u662f\u5e76\u4e0d\u59a8\u788d\u5c06\u5b83\u7528\u6765\u505asession\u5171\u4eab\uff1a<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u5047\u5982\u524d\u7aef\u662fsquid\uff0c\u4ed6\u4f1a\u5c06ip\u52a0\u5165x_forwarded_for\u8fd9\u4e2ahttp_header\u91cc\uff0c\u7528upstream_hash\u53ef\u4ee5\u7528\u8fd9\u4e2a\u5934\u505a\u56e0\u5b50\uff0c\u5c06\u8bf7\u6c42\u5b9a\u5411\u5230\u6307\u5b9a\u7684\u540e\u7aef\uff1a<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u53ef\u89c1\u8fd9\u7bc7\u6587\u6863\uff1a<a style=\"color:#1a8bc8;text-decoration:none;\" href=\"http:\/\/www.sudone.com\/nginx\/nginx_url_hash.html\">http:\/\/www.sudone.com\/nginx\/nginx_url_hash.html<\/a><\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u5728\u6587\u6863\u4e2d\u662f\u4f7f\u7528$request_uri\u505a\u56e0\u5b50\uff0c\u7a0d\u5fae\u6539\u4e00\u4e0b\uff1a<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">hash&nbsp;&nbsp; $http_x_forwarded_for;<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u8fd9\u6837\u5c31\u6539\u6210\u4e86\u5229\u7528x_forwarded_for\u8fd9\u4e2a\u5934\u4f5c\u56e0\u5b50\uff0c\u5728nginx\u65b0\u7248\u672c\u4e2d\u53ef\u652f\u6301\u8bfb\u53d6cookie\u503c\uff0c\u6240\u4ee5\u4e5f\u53ef\u4ee5\u6539\u6210\uff1a<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">hash&nbsp;&nbsp; $cookie_jsessionid;<\/p>\n<p style=\"line-height:19px;text-indent:0px;margin:10px auto;\">\u5047\u5982\u5728php\u4e2d\u914d\u7f6e\u7684session\u4e3a\u65e0cookie\u65b9\u5f0f\uff0c\u914d\u5408nginx\u81ea\u5df1\u7684\u4e00\u4e2auserid_module\u6a21\u5757\u5c31\u53ef\u4ee5\u7528nginx\u81ea\u53d1\u4e00\u4e2acookie\uff0c\u53ef\u53c2\u89c1userid\u6a21\u5757\u7684\u82f1\u6587\u6587\u6863\uff1a<br \/>\n<a style=\"color:#1a8bc8;text-decoration:none;\" href=\"http:\/\/wiki.nginx.org\/NginxHttpUserIdModule\">http:\/\/wiki.nginx.org\/NginxHttpUserIdModule<\/a><br \/>\n\u53e6\u53ef\u7528\u59da\u4f1f\u658c\u7f16\u5199\u7684\u6a21\u5757upstream_jvm_route\uff1a<a style=\"color:#1a8bc8;text-decoration:none;\" title=\"http:\/\/code.google.com\/p\/nginx-upstream-jvm-route\/\" href=\"http:\/\/code.google.com\/p\/nginx-upstream-jvm-route\/\">http:\/\/code.google.com\/p\/nginx-upstream-jvm-route\/<\/a><\/p>\n<\/blockquote>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div>\n<div>Nginx (\"engine x\") \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<\/div>\n<\/div>\n<p>\n\u9996\u5148\u662f\u914d\u7f6e\u5341\u5206\u7684\u7b80\u5355\uff0c\u800c\u4e14\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u3002<\/p>\n<p>\nworker_processes 1;<br \/>\nevents {<br \/>\nworker_connections 1024;<br \/>\n}<br \/>\nht...<\/p>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/84\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[284],"tags":[18],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-webserver","tag-nginx"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}