{"id":93,"date":"2020-06-08T16:54:29","date_gmt":"2020-06-08T08:54:29","guid":{"rendered":"https:\/\/22pig.com\/?p=93"},"modified":"2020-06-08T16:54:29","modified_gmt":"2020-06-08T08:54:29","slug":"nginx-%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"http:\/\/22pig.com\/?p=93","title":{"rendered":"Nginx \u914d\u7f6e"},"content":{"rendered":"<p>#user  nobody;<br \/>\nworker_processes  4; <\/p>\n<p>error_log  logs\/error.log;<br \/>\n#error_log  logs\/error.log  notice;<br \/>\n#error_log  logs\/error.log  info;<\/p>\n<p>#pid        logs\/nginx.pid;<\/p>\n<p>worker_rlimit_nofile 65535;<br \/>\nevents {<br \/>\n\tuse epoll;<br \/>\n\tworker_connections  10024;<br \/>\n}<\/p>\n<p>http {<br \/>\n\t#include    \/usr\/local\/nginx\/conf\/proxy.conf;<br \/>\n\t#include    \/usr\/local\/nginx\/conf\/vhosts\/www.test.com.conf;<\/p>\n<p>\tinclude       mime.types;<br \/>\n\tdefault_type  application\/octet-stream;<\/p>\n<p>\t#log_format  main  &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8220;$request&#8221; &#8216;<br \/>\n\t#                  &#8216;$status $body_bytes_sent &#8220;$http_referer&#8221; &#8216;<br \/>\n\t#                  &#8216;&#8221;$http_user_agent&#8221; &#8220;$http_x_forwarded_for&#8221;&#8216;;<\/p>\n<p>\t#access_log  logs\/access.log  main;<\/p>\n<p>\tsendfile        on;<br \/>\n\t#tcp_nopush     on;<\/p>\n<p>\t#keepalive_timeout  0;<br \/>\n\tkeepalive_timeout  65;<\/p>\n<p>\t#gzip  on;<br \/>\n\tclient_max_body_size 1000M;<br \/>\n\tclient_body_buffer_size 128K;<br \/>\n\tserver_tokens  off;<\/p>\n<p>\tfastcgi_connect_timeout 300s;<br \/>\n\tfastcgi_send_timeout 300s;<br \/>\n\tfastcgi_read_timeout 300s;<br \/>\n\tfastcgi_buffer_size 128k;<br \/>\n\tfastcgi_buffers 8 128k;#8 128<br \/>\n\tfastcgi_busy_buffers_size 256k;<br \/>\n\tfastcgi_temp_file_write_size 256k;<br \/>\n\tfastcgi_intercept_errors on; <\/p>\n<p>\tserver {<br \/>\n\t\tlisten       80;<br \/>\n\t\tserver_name  localhost;<\/p>\n<p>\t\t#charset koi8-r;<\/p>\n<p>\t\t#access_log  logs\/host.access.log  main;<\/p>\n<p>\t\t#add_header                  Set-Cookie &#8220;HttpOnly&#8221;;<br \/>\n\t\t#add_header                  Set-Cookie &#8220;Secure&#8221;;<br \/>\n\t\t#add_header                  X-Frame-Options &#8220;SAMEORIGIN&#8221;;<\/p>\n<p>        location \/ {<br \/>\n            root   html;<br \/>\n            index  index.html index.htm index.jsp;<br \/>\n            proxy_pass  http:\/\/oa.xxx.com;<br \/>\n            proxy_read_timeout 300; #3600#second<br \/>\n            proxy_send_timeout 300;  #3600<br \/>\n            proxy_buffer_size  128k;<br \/>\n            proxy_buffers   32 32k;<br \/>\n            proxy_busy_buffers_size 128k;<br \/>\n            proxy_redirect    http:\/\/ $scheme:\/\/;<br \/>\n            #proxy_temp_file_write_size  128k;<br \/>\n            proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;<br \/>\n            proxy_set_header  X-Real-IP  $remote_addr;<br \/>\n            proxy_set_header  Host $http_host;<br \/>\n        }<\/p>\n<p>        #error_page  404              \/404.html;<\/p>\n<p>        # redirect server error pages to the static page \/50x.html<br \/>\n        #<br \/>\n        error_page   500 502 503 504  \/50x.html;<br \/>\n        location = \/50x.html {<br \/>\n            root   html;<br \/>\n        }<\/p>\n<p>    }<\/p>\n<p>\tupstream oa.xxx.com {<br \/>\n\t\tsticky;<br \/>\n\t\t#ip_hash;<br \/>\n\t\tserver 192.168.8.161:8080;#app1<br \/>\n\t\tserver 192.168.8.162:8080;#app2<\/p>\n<p>\t\t#server 192.168.1.100:8001 down;<br \/>\n\t\t#server 192.168.1.100:8002 max_fails=3;<br \/>\n\t\t#server 192.168.1.100:8003 fail_timeout=20s;<br \/>\n\t\t#server 192.168.1.100:8004 max_fails=3 fail_timeout=20s;<br \/>\n\t\t#jvm_route $cookie_JSESSIONID|sessionid;<br \/>\n\t}<\/p>\n<p>\tserver {<br \/>\n\t\tlisten  9081;<br \/>\n\t\tserver_name secondProxyServer;<br \/>\n\t\tlocation \/ {<br \/>\n\t\t\tproxy_pass http:\/\/192.168.8.161:9081;<br \/>\n\t\t}<br \/>\n\t} <\/p>\n<p>\tserver {<br \/>\n\t\tlisten  9082;<br \/>\n\t\tserver_name secondProxyServer;<br \/>\n\t\tlocation \/ {<br \/>\n\t\t\tproxy_pass http:\/\/192.168.8.162:9081;<br \/>\n\t\t}<br \/>\n\t} <\/p>\n<p>\tserver {<br \/>\n\t\tlisten  443 ssl;<br \/>\n\t\tserver_name  oa.xxx.com;<\/p>\n<p>\t\tssl                  on;<br \/>\n\t\tssl_certificate      \/usr\/local\/nginx\/keys\/1_oa.xxx.com_bundle.crt;<br \/>\n\t\tssl_certificate_key  \/usr\/local\/nginx\/keys\/2_oa.xxx.com.key;<\/p>\n<p>\t\tssl_protocols  SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;<br \/>\n\t\tssl_ciphers  TLSv1:+HIGH:-MEDIUM:-LOW:-EXPORT:-aNULL:-eNULL:@STRENGTH;<br \/>\n\t\tssl_prefer_server_ciphers   on;<\/p>\n<p>\t\tlocation \/ {<br \/>\n\t\t\tproxy_pass http:\/\/oa.xxx.com;<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#user nobody; worker_processes 4; error_log logs\/error.log; #error_log logs\/error.log notice; #error_log logs\/error.log info; #pid logs\/nginx.pid; worker_rlimit_nofile 65535; events { use epoll; worker_connections 10024; } http { #include \/usr\/local\/nginx\/conf\/proxy.conf; #include \/usr\/local\/nginx\/conf\/vhosts\/www.test.com.conf; include mime.types; default_type application\/octet-stream; #log_format main &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8220;$request&#8221; &#8216; # &#8216;$status $body_bytes_sent &#8220;$http_referer&#8221; &#8216; # &#8216;&#8221;$http_user_agent&#8221; &#8220;$http_x_forwarded_for&#8221;&#8216;; #access_log logs\/access.log main; sendfile on; #tcp_nopush [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93"}],"version-history":[{"count":0,"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts\/93\/revisions"}],"wp:attachment":[{"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}