nginx.conf

#Nginx所用用戶和組,window下不指定  
#user  niumd niumd;  
 
#工作的子進程數量(通常等於CPU數量或者2倍於CPU) 
worker_processes  2; 
 
#錯誤日誌存放路徑 
#error_log  logs/error.log; 
#error_log  logs/error.log  notice; 
error_log  logs/error.log  info; 
 
#指定pid存放文件 
pid        logs/nginx.pid; 
 
events { 
    #使用網絡IO模型linux建議epoll,FreeBSD建議採用kqueue,window下不指定。 
    #use epoll; 
     
    #允許最大連接數 
    worker_connections  2048; 

 
http { 
    include       mime.types; 
    default_type  application/octet-stream; 
 
        #定義日誌格式 
    #log_format  main  '$remote_addr - $remote_user [$time_local] $request ' 
    #                  '"$status" $body_bytes_sent "$http_referer" ' 
    #                  '"$http_user_agent" "$http_x_forwarded_for"'; 
 
    #access_log  off; 
    access_log  logs/access.log; 
 
    client_header_timeout  3m; 
    client_body_timeout    3m; 
    send_timeout           3m; 
  
    client_header_buffer_size    1k; 
    large_client_header_buffers  4 4k; 
 
    sendfile        on; 
    tcp_nopush      on; 
    tcp_nodelay     on; 
 
    #keepalive_timeout  75 20; 
 
    #include    gzip.conf; 
    upstream localhost { 
      #根據ip計算將請求分配各那個後端tomcat,許多人誤認爲可以解決session問題,其實並不能。 
      #同一機器在多網情況下,路由切換,ip可能不同 
      #ip_hash;  
      server localhost:18081; 
      server localhost:18080; 
     } 
 
    server { 
            listen       80; 
            server_name  localhost;    
 
            location / { 
                    proxy_connect_timeout   3; 
                    proxy_send_timeout      30; 
                    proxy_read_timeout      30; 
                        proxy_pass http://localhost; 
            } 
             
   } 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章