nginx.conf配置demo

#user  nobody;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    accept_mutex off;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    charset   utf-8;

    #access_log  logs/access.log  main;
    sendfile        on;
    sendfile_max_chunk 512k;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
    
    client_max_body_size 10m;

    # another virtual host using mix of IP-, name-, and port-based configuration
    #

    server {
        listen       80;
        server_name  localhost;
     proxy_intercept_errors on;  #配置error_page 错误页面开启
    #文件服务器1
        location "/C5F2B2C6-4262-EA28-F027-C335ECAEA9B3/Accessible File/" {
                alias "D:/storeShare2/8C2FA5BC-7916-8310-EE65-C77C8A7916AE/Accessible File/";
        }

        location "/BAEAA014-7D66-35CE-89B6-EAE8E3338BC7/" {
                charset utf-8;
                alias "D:/storeShare2/8C2FA5BC-7916-8310-EE65-C77C8A7916AE/"; #文件的根目录(允许使用本地磁盘,NFS,NAS,NBD等)
        }
                     
    #文件服务器2
        location "/19E1CDA4-D4F9-A4D4-5FB5-CD0D338DDF75/Accessible File/" {
                alias "D:/storeShare/34ABAD14-C547-DA72-1D61-97ABF395BCD0/Accessible File/";
        }

        location "/783C4C77-D3EF-C2A7-174B-974BF69C1987/" {
                charset utf-8;
                alias "D:/storeShare/34ABAD14-C547-DA72-1D61-97ABF395BCD0/"; #文件的根目录(允许使用本地磁盘,NFS,NAS,NBD等)
        }    

    #负载均衡服务器上的文件预览与文件下载
        location ~^/preview/http:/(.*)$ {
        proxy_redirect  off;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass  http://$1; 
                        
        }
        location ~^/downloadfile/http://(.*)$ {
        charset utf-8;
                internal;  
        proxy_redirect  off;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass  http://$1; 
                        
        }    
        
    #负载均衡服务器上的web服务器跳转
    location / {
        charset utf-8;
        proxy_redirect  off;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass  http://127.0.0.1:8080/PodCloud/;  #首先pass到应用服务器  
        }

        location /PodCloud/ {
        charset utf-8;
        proxy_redirect  off;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass  http://127.0.0.1:8080/PodCloud/;  #首先pass到应用服务器   
        }
    

      error_page 400 401 402 403 404 405 408 410 412 413 414 415 500 501 502 503 504 506 /404.html;
      location = /404.html {
        #放错误页面的目录路径。
        #proxy_pass http://127.0.0.1:80/404.html;
        root D:/nginx-1.9.12/html;
      }

    }
}

 

posted @ 2019-06-21 16:45  霞光里  阅读(1256)  评论(0编辑  收藏  举报