{"id":2793,"date":"2017-10-20T09:13:36","date_gmt":"2017-10-20T01:13:36","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=2793"},"modified":"2017-10-20T09:13:36","modified_gmt":"2017-10-20T01:13:36","slug":"nginx%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/fuwuqi\/nginx%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95\/","title":{"rendered":"nginx\u914d\u7f6e\u65b9\u6cd5"},"content":{"rendered":"<pre>user root root;\r\nworker_processes 2;\r\n \r\n#error_log logs\/error.log;\r\n#error_log logs\/error.log notice;\r\n#error_log logs\/error.log info;\r\n \r\n#pid logs\/nginx.pid;\r\n \r\n \r\nevents {\r\n  worker_connections 1024;\r\n  use epoll;\r\n}\r\n \r\n \r\nhttp {\r\n  include mime.types;\r\n  default_type application\/octet-stream;\r\n \r\n  #log_format main '$remote_addr - $remote_user [$time_local] \"$request\" '\r\n  # '$status $body_bytes_sent \"$http_referer\" '\r\n  # '\"$http_user_agent\" \"$http_x_forwarded_for\"';\r\n \r\n  #access_log logs\/access.log main;\r\n \r\n  sendfile on;\r\n  #tcp_nopush on;\r\n \r\n  #keepalive_timeout 0;\r\n  keepalive_timeout 65;\r\n \r\n  #gzip on;\r\n \r\n  #\u670d\u52a1\u5668\u7684\u96c6\u7fa4  \r\n  upstream  mySite.com { #\u670d\u52a1\u5668\u96c6\u7fa4\u540d\u5b57   \r\n  #ip_hash;\r\n  #web\u670d\u52a1\u56681\r\n  server 10.30.x.x:80 weight=10;\r\n  #web\u670d\u52a1\u56682\r\n  #server 10.30.x.x:80 weight=10;\r\n  #server 114.119.x.x:10051 weight=5;#\u670d\u52a1\u5668\u914d\u7f6e weight\u662f\u6743\u91cd\u7684\u610f\u601d\uff0c\u6743\u91cd\u8d8a\u5927\uff0c\u5206\u914d\u7684\u6982\u7387\u8d8a\u5927\u3002  \r\n  #server 114.119.x.x:10057 weight=1;  \r\n  }\r\n \r\n  server {\r\n  listen 80;\r\n  server_name x.x.com;\r\n  #server_name localhost;\r\n \r\n\r\n  #charset koi8-r;\r\n \r\n  #access_log logs\/host.access.log main;\r\n \r\n  location \/ {\r\n  proxy_pass https:\/\/mySite.com;  \r\n  #\u4ee5\u4e0b\u914d\u7f6e\u7528\u4e8e\u83b7\u53d6\u771f\u5b9eIP\r\n  proxy_set_header Host $host;\r\n  proxy_set_header X-real-ip $remote_addr;\r\n  proxy_set_header REMOTE-HOST $remote_addr;\r\n  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n  #\u5173\u95ed\u7f13\u5b58\r\n  #add_header Cache-Control 'no-store';\r\n  }\r\n \r\n  #error_page 404 \/404.html;\r\n \r\n  # redirect server error pages to the static page \/50x.html\r\n  #\r\n  error_page 500 502 503 504 \/50x.html;\r\n  location = \/50x.html {\r\n  root html;\r\n  }\r\n \r\n  # proxy the PHP scripts to Apache listening on 127.0.0.1:80\r\n  #\r\n  #location ~ \\.php$ {\r\n  # proxy_pass https:\/\/127.0.0.1;\r\n  #}\r\n \r\n  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\r\n  #\r\n  #location ~ \\.php$ {\r\n  # root html;\r\n  # fastcgi_pass 127.0.0.1:9000;\r\n  # fastcgi_index index.php;\r\n  # fastcgi_param SCRIPT_FILENAME \/scripts$fastcgi_script_name;\r\n  # include fastcgi_params;\r\n  #}\r\n \r\n  # deny access to .htaccess files, if Apache's document root\r\n  # concurs with nginx's one\r\n  #\r\n  #location ~ \/\\.ht {\r\n  # deny all;\r\n  #}\r\n  }\r\n \r\n \r\n  # another virtual host using mix of IP-, name-, and port-based configuration\r\n  #\r\n  #server {\r\n  # listen 8000;\r\n  # listen somename:8080;\r\n  # server_name somename alias another.alias;\r\n \r\n  # location \/ {\r\n  # root html;\r\n  # index index.html index.htm;\r\n  # }\r\n  #}\r\n \r\n \r\n  # HTTPS server\r\n  #\r\n  #server {\r\n  # listen 443 ssl;\r\n  # server_name localhost;\r\n \r\n  # ssl_certificate cert.pem;\r\n  # ssl_certificate_key cert.key;\r\n \r\n  # ssl_session_cache shared:SSL:1m;\r\n  # ssl_session_timeout 5m;\r\n \r\n  # ssl_ciphers HIGH:!aNULL:!MD5;\r\n  # ssl_prefer_server_ciphers on;\r\n \r\n  # location \/ {\r\n  # root html;\r\n  # index index.html index.htm;\r\n  # }\r\n  #}\r\n \r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>user root root; worker_processes 2; #error_log logs\/err &#8230; <a title=\"nginx\u914d\u7f6e\u65b9\u6cd5\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/fuwuqi\/nginx%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95\/\" aria-label=\"\u9605\u8bfb nginx\u914d\u7f6e\u65b9\u6cd5\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49,9,11],"tags":[],"class_list":["post-2793","post","type-post","status-publish","format-standard","hentry","category-linux","category-fuwuqi","category-chengxujiaoben"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=2793"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2793\/revisions"}],"predecessor-version":[{"id":2794,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2793\/revisions\/2794"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=2793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=2793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=2793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}