自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

ngnix配置文件如何達到負載均衡

開發(fā) 前端
ngnix配置文件不是我們想象的那么簡單。其實有不少的事情需要我們注意,接下來我們就來學(xué)些有關(guān)這方面的問題,希望大家有所收獲。

ngnix配置文件在使用的時候需要進行負載均衡,但是要如何才能完整這一個動作呢?下面我們就向大家介紹我的ngnix配置文件(nginx +tomcat包括 虛擬目錄,負載均衡和url_Rewrite)

 

 

  1. #user nobody;  
  2. worker_processes 10;  
  3. error_log /home/weblogs/error.log crit;  
  4. #error_log logs/error.log notice;  
  5. #error_log logs/error.log info;  
  6. pid logs/nginx.pid;  
  7. worker_rlimit_nofile 51200;  
  8. events {  
  9. use epoll;  
  10. worker_connections 51200;  
  11. }  
  12. http {  
  13. include mime.types;  
  14. default_type application/octet-stream;  
  15. include proxy.conf;   
  16. log_format main '$remote_addr - $remote_user [$time_local] $request '  
  17. '"$status" $body_bytes_sent "$http_referer" '  
  18. '"$http_user_agent" "$http_x_forwarded_for"';  
  19. access_log /home/weblogs/access.log main;  
  20. server_names_hash_bucket_size 128;  
  21. #sendfile on;  
  22. #tcp_nopush on;  
  23. # tcp_nodelay on;  
  24. #keepalive_timeout 0;  
  25. #keepalive_timeout 60;  
  26. #gzip off;  
  27. #gzip_min_length 1k;  
  28. #gzip_buffers 4 8k;  
  29. #gzip_http_version 1.1;   
  30. #gzip_types text/plain application/x-javascript text/css text/html application/xml;  
  31. client_header_buffer_size 32k;  
  32. large_client_header_buffers 4 32k;  
  33. sendfile on;  
  34. tcp_nopush on;  
  35. keepalive_timeout 60;  
  36. tcp_nodelay on;  
  37. gzip on;  
  38. gzip_min_length 1k;  
  39. gzip_buffers 4 16k;  
  40. gzip_http_version 1.0;  
  41. gzip_comp_level 2;  
  42. gzip_types text/plain application/x-javascript text/css application/xml;  
  43. gzip_vary on;  
  44. upstream hljbstCms {  
  45. #ip_hash;  
  46. server localhost:8080 ;  
  47. server localhost:8081;  
  48. }  
  49. server {  
  50. server_name _;  
  51. listen 80;  
  52. charset gb2312;   
  53. location /(WEB-INF)/ {   
  54. deny all;   
  55. }   
  56. location /html/ {  
  57. index index.html;  
  58. root /home;  
  59. }  
  60. location /img/{  
  61. root /home;  
  62. }  
  63. location /res/{  
  64. root /home;  
  65. }  
  66. location / {  
  67. if ($host ~* "^[a-z0-9\-]+\.hljbst\.com$"){  
  68. rewrite ^/?$ /$host last;  
  69. rewrite ^/([a-z0-9\-]+)\.hljbst\.com/?$ http://$host/site/$1 permanent;  
  70. }   
  71. proxy_pass http://hljbstCms;  
  72. include proxy.conf;   
  73. }  
  74. location /NginxStatus {  
  75. #stub_status on;  
  76. access_log on;  
  77. auth_basic "NginxStatus";  
  78. auth_basic_user_file conf/htpasswd;  
  79. }  
  80. #error_page 404 /404.html;  
  81. # redirect server error pages to the static page /50x.html  
  82. #  
  83. error_page 500 502 503 504 /50x.html;  
  84. location = /50x.html {  
  85. root /home/ngnix/html;  
  86. }  
  87. }  

 

 

以上就是對ngnix配置文件的詳細介紹。

【編輯推薦】

  1. nginx配置中運行與啟動的詳細介紹
  2. nginx服務(wù)器如何處理相關(guān)的圖片
  3. nginx配置相關(guān)結(jié)構(gòu)劃分的技巧
  4. nginx配置文件實現(xiàn)AWStats靜態(tài)頁面
  5. nginx 禁止IP訪問的代碼編寫教程
責(zé)任編輯:張浩 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-04-26 10:27:39

鏈路負載均衡

2019-03-15 15:02:31

F5Ngnix負載均衡

2010-03-25 18:52:15

Nginx負載均衡

2017-05-19 14:45:01

OVN負載均衡器路由器

2010-04-22 12:45:05

2010-04-21 12:28:50

Oracle負載均衡

2011-11-22 21:26:59

pfSense配置Web服務(wù)器負載均衡

2010-04-20 22:19:29

tomcat負載均衡配

2014-07-28 11:37:49

NginxTomcat

2017-07-03 08:08:25

負載均衡分類

2021-11-07 14:00:16

JekyllBashAPI后端

2011-04-28 14:56:29

XenServer負載

2010-04-20 21:27:28

tomcat負載均衡配

2012-05-07 10:17:48

2010-04-22 16:41:56

負載均衡端口規(guī)則

2010-04-23 11:05:16

流量負載均衡

2010-05-05 23:27:32

負載均衡配置

2010-05-05 17:57:59

ADSL負載均衡

2010-05-06 12:02:43

路由負載均衡

2010-05-04 10:56:18

jboss負載均衡
點贊
收藏

51CTO技術(shù)棧公眾號