nginx详解



#user   nobody nobody;
user  root;
worker_processes  1;//同时工作的线程数


#error_log  logs/error.log;


#用来指定进程id的存储文件的位置
#pid        logs/nginx.pid;


#用于指定一个进程可以打开最多文件数量的描述
worker_rlimit_nofile 10240;




events {   #针对nginx服务器的工作模式的一些操作配置
    worker_connections  10240;#指定最大可以同时接收的连接数量,这里一定要注意,最大连接数量是和worker processes共同决定的
}


 




http {
    include       mime.types;#指定在当前文件中包含另一个文件的指令
    default_type  application/octet-stream;#指定默认处理的文件类型可以是二进制
      
      log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent $request_body '
                      '"$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';                
    
    server_tokens off; 
    sendfile off; 
    tcp_nopush on; 
    tcp_nodelay on; 
     
    client_header_timeout 10;  #设置请求头的超时时间
    client_body_timeout 10; #设置请求体的超时时间
    reset_timedout_connection on; 
    send_timeout 10; #指定客户端响应超时时间,如果客户端两次操作间隔超过这个时间,服务器就会关闭这个链接
    proxy_ignore_client_abort on;


    server_names_hash_bucket_size 128;   
    client_header_buffer_size 32k;  
    large_client_header_buffers 4 32k;   
    client_max_body_size 8m;  
    keepalive_timeout  65;#给客户端分配连接超时时间,服务器会在这个时间过后关闭连接。一般设置时间较短,可以让nginx工作持续性更好 
    
    
    gzip on;#是告诉nginx采用gzip压缩的形式发送数据。这将会减少我们发送的数据量
    gzip_min_length  0;
    gzip_buffers     16 8k;
    gzip_http_version 1.1;
    gzip_comp_level 9;
    gzip_types       text/plain text/css image/x-icon image/png image/jpg;
    gzip_vary on;
    
#      upstream  weizhan_91yaowang_com  { #主要负责负载均衡的配置,通过默认的轮询调度方式来分发请求到后端服务器
#      server 127.27.176.142:80 weight=10;
#      keepalive 32;
#     }        
server {
        listen       443;//监听的端口
        server_name    s3.gocfae.com;//
        index index.jsp index.html index.do index.htm index.php ;
        #root   html;
        access_log  logs/s3.access.log;
        error_log logs/s3.error.log error;
        ssl   on;
        ssl_certificate  /ywdata/credentials/s3.gocfae.com/Nginx/1_s3.gocfae.com_bundle.crt;
        ssl_certificate_key   /ywdata/credentials/s3.gocfae.com/Nginx/2_s3.gocfae.com.key;


        location  /cms/ {
        proxy_pass http://zbqjs02-oss-test06.oss-cn-hangzhou.aliyuncs.com/cms/; //nginx就是通过拦截到的请求去对配置好的location块(location block)进行请求代理的。
      } 
        location  /static/ {

        proxy_pass http://zbqjs02-oss-test06.oss-cn-hangzhou.aliyuncs.com/static/;  //nginx就是通过拦截到的请求去对配置好的location块(location block)进行请求代理的。
      }


}
server {
        listen       443;
        server_name    s1.sh.cgfae.cn;
        index index.jsp index.html index.do index.htm index.php ;
        #root   html;
        access_log  logs/s1.sh.access.log;
        error_log logs/s1.sh.error.log error;
        ssl   on;
        ssl_certificate  /ywdata/credentials/sh.cgfae.cn/214506897300611.pem;
        ssl_certificate_key   /ywdata/credentials/sh.cgfae.cn/214506897300611.key;


        location  / {
        proxy_pass http://zbganjs02-oss-test03.oss-cn-hangzhou.aliyuncs.com/index.html;
      }
        location  /static/ {
        proxy_pass http://zbganjs02-oss-test03.oss-cn-hangzhou.aliyuncs.com/static/;
      }


}


server {
        listen       443;
        server_name    s3.sh.cgfae.cn;
        index index.jsp index.html index.do index.htm index.php ;
        #root   html;
        access_log  logs/s3.sh.access.log;
        error_log logs/s3.sh.error.log error;
        ssl   on;
        ssl_certificate   /ywdata/credentials/sh.cgfae.cn/214506897300611.pem;
        ssl_certificate_key   /ywdata/credentials/sh.cgfae.cn/214506897300611.key;


        location  /cms/ {
        proxy_pass http://zbganjs02-oss-test02.oss-cn-hangzhou.aliyuncs.com/cms/;
      }
        location  /static/ {
        proxy_pass http://zbganjs02-oss-test02.oss-cn-hangzhou.aliyuncs.com/static/;
      }
}


server {
        listen      443;
        server_name    api.sh.cgfae.cn;
        index index.jsp index.html index.do index.htm index.php ;
        #root   html;
        access_log  logs/api.sh.access.log;
        error_log logs/api.sh.error.log error;
        ssl   on;
        ssl_certificate  /ywdata/credentials/sh.cgfae.cn/214506897300611.pem;
        ssl_certificate_key   /ywdata/credentials/sh.cgfae.cn/214506897300611.key;


        location  / {
        proxy_pass http://172.17.20.102:9001;
      }
}
server {
        listen       443;
        server_name    openapi.sh.cgfae.cn;
        index index.jsp index.html index.do index.htm index.php ;
        #root   html;
        access_log  logs/openapi.sh.access.log;
        error_log logs/openapi.sh.error.log error;
        ssl   on;
        ssl_certificate  /ywdata/credentials/sh.cgfae.cn/214506897300611.pem;
        ssl_certificate_key    /ywdata/credentials/sh.cgfae.cn/214506897300611.key;


        location  / {
        proxy_pass http://172.17.20.101:9002;
      }
}
server {
        listen       80;
        server_name   eureka.gocfae.com;
       # index index.jsp index.html index.do index.htm index.php ;
        access_log  logs/eureka.access.log;
        error_log logs/eureka.error.log error;
        #ssl   on;
        #ssl_certificate  /ywdata/credentials/openapi.gocfae.com/Nginx/1_openapi.gocfae.com_bundle.crt;
        #ssl_certificate_key   /ywdata/credentials/openapi.gocfae.com/Nginx/2_openapi.gocfae.com.key;


        location  / {
        proxy_pass http://172.17.20.100:8761/;
      }
}


server {
        listen       80;
        server_name   47.97.203.122;
       # index index.jsp index.html index.do index.htm index.php ;
        access_log  logs/eureka.access.log;
        error_log logs/eureka.error.log error;
        #ssl   on;
        #ssl_certificate  /ywdata/credentials/openapi.gocfae.com/Nginx/1_openapi.gocfae.com_bundle.crt;
        #ssl_certificate_key   /ywdata/credentials/openapi.gocfae.com/Nginx/2_openapi.gocfae.com.key;


        location  /cust/ {
        proxy_pass http://172.17.20.103:8762/;
      }
      location  /product/ {
        proxy_pass http://172.17.20.104:8762;
      }
        location  /order/ {
        proxy_pass http://172.17.20.107:8080;
      }
        location  /trans/ {
        proxy_pass http://172.17.20.108:8773;
      }


}
server {
        listen       80;
        server_name   market-test.gocfae.com;
       # index index.jsp index.html index.do index.htm index.php ;
        access_log  logs/eureka.access.log;
        error_log logs/eureka.error.log error;
        #ssl   on;
        #ssl_certificate  /ywdata/credentials/openapi.gocfae.com/Nginx/1_openapi.gocfae.com_bundle.crt;
        #ssl_certificate_key   /ywdata/credentials/openapi.gocfae.com/Nginx/2_openapi.gocfae.com.key;


        location  / {
        proxy_pass http://172.17.20.105:9017/;
      }
}


server {
        listen       80;
        server_name   market-txs-test.gocfae.com;
       # index index.jsp index.html index.do index.htm index.php ;
        access_log  logs/eureka.access.log;
        error_log logs/eureka.error.log error;
        #ssl   on;
        #ssl_certificate  /ywdata/credentials/openapi.gocfae.com/Nginx/1_openapi.gocfae.com_bundle.crt;
        #ssl_certificate_key   /ywdata/credentials/openapi.gocfae.com/Nginx/2_openapi.gocfae.com.key;


        location  / {
        proxy_pass http://172.17.20.106:9018/;
      }
}


}
展开阅读全文

没有更多推荐了,返回首页