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

Nginx配置中運行與啟動的詳細介紹

開發(fā) 前端
Nginx配置一個神奇的Web服務器,我們在使用的時候有不少需要注意的,接下來我們就看看如何才能簡單明了的進行Nginx服務器的配置。

我們在進行Nginx配置的時候會出現(xiàn)很多不明白的地方,其實有些時候只要換一個思維的方式就能找多你要解決問題的方法。下面我們就向大家詳細的介紹有關Nginx配置的相關信息。

  1. #運行用戶   
  2. user nobody nobody;   
  3. #啟動進程   
  4. worker_processes 2;   
  5. #全局錯誤日志及PID文檔   
  6. error_log logs/error.log notice;   
  7. pid logs/Nginx.pid;   
  8. #工作模式及連接數(shù)上限   
  9. events {   
  10. use epoll;   
  11. worker_connections 1024;   
  12. }   
  13. #設定http服務器,利用他的反向代理功能提供負載均衡支持   
  14. http {   
  15. #設定mime類型   
  16. include conf/mime.types;   
  17. default_type application/octet-stream;   
  18. #設定日志格式   
  19. log_format main '$remote_addr - $remote_user [$time_local] '   
  20. '"$request" $status $bytes_sent '   
  21. '"$http_referer" "$http_user_agent" '   
  22. '"$gzip_ratio"';   
  23. log_format download '$remote_addr - $remote_user [$time_local] '   
  24. '"$request" $status $bytes_sent '   
  25. '"$http_referer" "$http_user_agent" '   
  26. '"$http_range" "$sent_http_content_range"';   
  27. #設定請求緩沖   
  28. client_header_buffer_size 1k;   
  29. large_client_header_buffers 4 4k;   
  30. #開啟gzip模塊   
  31. gzip on;   
  32. gzip_min_length 1100;   
  33. gzip_buffers 4 8k;   
  34. gzip_types text/plain;   
  35. output_buffers 1 32k;   
  36. postpone_output 1460;   
  37. #設定access log   
  38. access_log logs/access.log main;   
  39. client_header_timeout 3m;   
  40. client_body_timeout 3m;   
  41. send_timeout 3m;   
  42. sendfile on;   
  43. tcp_nopush on;   
  44. tcp_nodelay on;   
  45. keepalive_timeout 65;   
  46. #設定負載均衡的服務器列表   
  47. upstream mysvr {   
  48. #weigth參數(shù)表示權值,權值越高被分配到的幾率越大   
  49. #本機上的Squid開啟3128端口   
  50. server 192.168.8.1:3128 weight=5;   
  51. server 192.168.8.2:80 weight=1;   
  52. server 192.168.8.3:80 weight=6;   
  53. }   
  54. #設定虛擬主機   
  55. server {   
  56. listen 80;   
  57. server_name 192.168.8.1   
  58. www.yejr.com   
  59. ;   
  60. charset gb2312;   
  61. #設定本虛擬主機的訪問日志   
  62. access_log logs/www.yejr.com.access.log main;   
  63. #假如訪問 /img/*, /js/*, /css/* 資源,則直接取本地文檔,不通過squid   
  64. #假如這些文檔較多,不推薦這種方式,因為通過squid的緩存效果更好   
  65. location ~ ^/(img|js|css)/ {   
  66. root /data3/Html;   
  67. expires 24h;   
  68. }   
  69. #對 "/" 啟用負載均衡   
  70. location / {   
  71. proxy_pass http://mysvr;   
  72. proxy_redirect off;   
  73. proxy_set_header Host $host;   
  74. proxy_set_header X-Real-IP $remote_addr;   
  75. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;   
  76. client_max_body_size 10m;   
  77. client_body_buffer_size 128k;   
  78. proxy_connect_timeout 90;   
  79. proxy_send_timeout 90;   
  80. proxy_read_timeout 90;   
  81. proxy_buffer_size 4k;   
  82. proxy_buffers 4 32k;   
  83. proxy_busy_buffers_size 64k;   
  84. proxy_temp_file_write_size 64k;   
  85. }   
  86. #設定查看Nginx狀態(tài)的地址   
  87. location /NginxStatus {   
  88. stub_status on;   
  89. access_log on;   
  90. auth_basic "NginxStatus";   
  91. auth_basic_user_file conf/htpasswd;   
  92. }   
  93. }   
  94. }  

備注:conf/htpasswd 文檔的內(nèi)容用 apache 提供的 htpasswd 工具來產(chǎn)生即可,內(nèi)容大致如下:

3.) 查看 Nginx 運行狀態(tài) 輸入地址http://192.168.8.1/NginxStatus/ 。輸入驗證帳號密碼,即可看到類似如下內(nèi)容:

  1. Active connections: 328   
  2. server accepts handled requests   
  3. 9309 8982 28890   
  4. Reading: 1 Writing: 3 Waiting: 324  

***行表示現(xiàn)在活躍的連接數(shù),第三行的第三個數(shù)字表示Nginx運行到。

【編輯推薦】

  1. 安裝Ubuntu Nginx及其配置安裝Php和mysql
  2. Ubuntu Nginx安裝編譯mono 2.0
  3. CentOS Nginx服務器配置Nginx.conf
  4. Linux Nginx配置Nginx.conf效率很高
  5. Linux Nginx安裝編譯MySQL 5.1.34擴展庫及Php Web服務器
責任編輯:張浩 來源: 博客園
相關推薦

2010-06-18 17:35:16

Linux Anacr

2009-12-22 15:02:40

WCF限流

2011-06-21 14:25:44

JavaScriptcookie

2011-07-08 16:54:39

JspCookies

2011-07-08 17:26:38

JSFStruts

2010-02-06 10:04:10

Android啟動模式

2009-07-01 10:12:40

JSP環(huán)境配置JSP引擎

2010-03-11 09:20:54

Ubuntu網(wǎng)絡配置

2011-06-08 16:05:34

VB數(shù)組

2011-07-20 15:58:53

C++引用

2011-07-11 11:02:12

JAVA集合框架

2011-07-13 15:47:18

MFC

2011-07-08 11:19:51

jspaction

2011-07-11 15:02:54

枚舉

2011-07-21 15:44:33

Java內(nèi)部類

2009-06-17 16:01:28

2010-07-06 14:32:02

2011-07-12 10:24:17

類加載反射

2020-06-29 14:10:28

JVM參數(shù)配置

2010-03-12 15:29:55

Ubuntu irtu
點贊
收藏

51CTO技術棧公眾號