中文字幕第五页-中文字幕第页-中文字幕韩国-中文字幕最新-国产尤物二区三区在线观看-国产尤物福利视频一区二区

如何進行Nginx反向代理與服務器的配置緩沖

本篇文章為大家展示了如何進行Nginx反向代理與服務器的配置緩沖,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。

公司主營業務:成都網站設計、網站建設、外貿網站建設、移動網站開發等業務。幫助企業客戶真正實現互聯網宣傳,提高企業的競爭能力。成都創新互聯是一支青春激揚、勤奮敬業、活力青春激揚、勤奮敬業、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰,讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。成都創新互聯推出寧蒗免費做網站回饋大家。

Nginx反向代理關于對后端服務器的配置。對于廣大的網管員來說nginx反向代理是必修的一門課。下面我們就來看看有關的內容。有三個后端服務,一個為web內容服務,一個是論壇服務,一個為文件服務。

當一個請求來時,nginx代理服務器其查看url把請求定向到相應的服務器,這個配置也緩沖文件服務的內容,但是論壇的和數據下載的內容就不緩存了,這個配置也使用了壓縮,更好的節省內存

  1. #######################################################  

  2. ### Calomel.org /etc/nginx.conf BEGIN  

  3. #######################################################  

  4. pid /var/run/nginx.pid;  

  5. user nginx nginx;  

  6. worker_processes 10;  

  7. events {  

  8. worker_connections 1024;  

  9. }  

  10. http {  

  11. ## MIME types  

  12. #include /etc/nginx_mime.types;  

  13. default_type application/octet-stream;  

  14. ## Size Limits  

  15. client_body_buffer_size 128K;  

  16. client_header_buffer_size 128K;  

  17. client_max_body_size 1M;  

  18. large_client_header_buffers 1 1k;  

  19. ## Timeouts  

  20. client_body_timeout 60;  

  21. client_header_timeout 60;  

  22. expires 24h;  

  23. keepalive_timeout 60 60;  

  24. send_timeout 60;  

  25. ## General Options  

  26. ignore_invalid_headers on;  

  27. keepalive_requests 100;  

  28. limit_zone gulag $binary_remote_addr 5m;  

  29. recursive_error_pages on;  

  30. sendfile on;  

  31. server_name_in_redirect off;  

  32. server_tokens off;  

  33. ## TCP options  

  34. tcp_nodelay on;  

  35. tcp_nopush on;  

  36. ## Compression  

  37. gzip on;  

  38. gzip_buffers 16 8k;  

  39. gzip_comp_level 6;  

  40. gzip_http_version 1.0;  

  41. gzip_min_length 0;  

  42. gzip_types text/plain text/css image/x-icon application/x-perl 
    application/x-httpd-cgi;  

  43. gzip_vary on;  

  44. ## Log Format  

  45. log_format main '$remote_addr $host $remote_user [$time_local] 
    "$request" '  

  46. '$status $body_bytes_sent "$http_referer" "$http_user_agent" '  

  47. '"$gzip_ratio"';  

  48. ## Proxy options  

  49. proxy_buffering on;  

  50. proxy_cache_min_uses 3;  

  51. proxy_cache_path /usr/local/nginx/proxy_temp/ levels=1:2 
    keys_zone=cache:10m inactive=10m max_size=1000M;  

  52. proxy_cache_valid any 10m;  

  53. proxy_ignore_client_abort off;  

  54. proxy_intercept_errors on;  

  55. proxy_next_upstream error timeout invalid_header;  

  56. proxy_redirect off;  

  57. proxy_set_header X-Forwarded-For $remote_addr;  

  58. proxy_connect_timeout 60;  

  59. proxy_send_timeout 60;  

  60. proxy_read_timeout 60;  

  61. ## Backend servers (web1 is the primary and web2 will 
    come up if web1 is down)  

  62. upstream webbackend {  

  63. server web1.domain.lan weight=10 max_fails=3 fail_timeout=30s;  

  64. server web2.domain.lan weight=1 backup;  

  65. }  

  66. server {  

  67. access_log /var/log/nginx/access.log main;  

  68. error_log /var/log/nginx/error.log;  

  69. index index.html;  

  70. limit_conn gulag 50;  

  71. listen 127.0.0.1:80 default;  

  72. root /usr/local/nginx/html;  

  73. server_name _;  

  74. ## Only requests to our Host are allowed  

  75. if ($host !~ ^(mydomain.com|www.mydomain.com)$ ) {  

  76. return 444;  

  77. }  

  78. ## Only allow these request methods  

  79. if ($request_method !~ ^(GET|HEAD|POST)$ ) {  

  80. return 444;  

  81. }  

  82. ## Only allow these file types to document root  

  83. location / {  

  84. if ($request_uri ~* (^\/|\.html|\.jpg|\.pl|\.png|\.css|\.
    ico|robots\.txt)$ ) {  

  85. break;  

  86. }  

  87. return 444;  

  88. }  

  89. ## PROXY - Forum   

  90. location /forum/ {  

  91. proxy_pass http://forum.domain.lan/forum/;  

  92. }  

  93. ## PROXY - Data  

  94. location /files/ {  

  95. proxy_pass http://data.domain.lan/;  

  96. }  

  97. ## PROXY - Web  

  98. location / {  

  99. proxy_pass http://webbackend;  

  100. proxy_cache cache;  

  101. proxy_cache_valid 200 24h;  

  102. proxy_cache_use_stale error timeout invalid_header updating 
    http_500 http_502 http_503 http_504;  

  103. proxy_ignore_headers Expires Cache-Control;  

  104. }  

  105. ## All other errors get the generic error page  

  106. error_page 400 401 402 403 404 405 406 407 408 409 410 411 
    412 413 414 415 416 417  

  107. 500 501 502 503 504 505 506 507 /error_page.html;  

  108. location /error_page.html {  

  109. internal;  

  110. }  

  111. }  

  112. }  

  113. #  

  114. #######################################################  

  115. ### Calomel.org /etc/nginx.conf END  

  116. #######################################################  

上述內容就是如何進行Nginx反向代理與服務器的配置緩沖,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注創新互聯行業資訊頻道。

當前文章:如何進行Nginx反向代理與服務器的配置緩沖
網頁地址:http://www.2m8n56k.cn/article48/pccgep.html

成都網站建設公司_創新互聯,為您提供App設計域名注冊、響應式網站、微信小程序、網站營銷網站制作

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

h5響應式網站建設
主站蜘蛛池模板: 久久久久久久国产免费看 | 做爰www免费看视频 1024色淫免费视频 | 日日摸日日碰夜夜97 | 国产精品久久久久免费视频 | 久久99精品久久久久久 | 亚洲欧洲精品国产二码 | 国产三级观看 | 大焦伊人| 午夜视频在线观看一区 | 91视频久久 | 在线中文 | 日本一级大黄毛片免费基地 | 香蕉视频911 | 欧美a大片欧美片 | 国产成人盗拍精品免费视频 | 国产视频自拍一区 | 台湾一级特黄精品大片 | 特级做a爰片毛片免费看 | 亚洲精品成人一区 | 亚洲高清国产拍精品影院 | 午夜刺激爽爽视频免费观看 | 免费男女乱淫真视频播放 | 亚洲看黄| 国产一区2区 | 久草免费小视频 | 久久综合久久久久 | 国产韩国精品一区二区三区 | 九九99靖品| 一级特黄aa大片欧美 | 中文国产日韩欧美视频 | 性欧美欧美巨大69 | 中文字幕 亚洲一区 | 亚洲精品成人一区二区 | 欧美a在线看| 99视频在线免费 | 国产在线一区二区三区 | 欧美日一区 | 成人看片免费 | 欧美国产综合日韩一区二区 | 中国女人真人一级毛片 | 精品久久久在线观看 |