
#user  nobody;
worker_processes  1;

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

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8888;
        server_name  localhost;

        #charset koi8-r;

        access_log  logs/host.access.log  main;
	
	root        D:\Server\vue\build-web\dist;#vue项目的打包后的dist

        location / {
            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
            index  index.html index.htm;
        }

	location @router {
        	rewrite ^.*$ /index.html last;
   	 }

    	location ^~ /api/ {
        	proxy_pass              http://172.16.3.12:8080;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/api/(.+?)$ /$1 break;
    	}
	location ^~ /img/ {
        	proxy_pass              http://192.168.20.225:8080;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/img/(.+?)$ /$1 break;
    	}
	location ^~ /seeImg/ {
        	proxy_pass              http://172.16.0.181:8890;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/seeImg/(.+?)$ /$1 break;
    	}
	location ^~ /asset/ {
        	proxy_pass              http://172.16.0.181:8889;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/asset/(.+?)$ /$1 break;
    	}
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
	location ^~ /physics/ {
        	proxy_pass              http://192.168.100.225:8080;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/physics/(.+?)$ /$1 break;
    	}
    }
    server {
        listen       8889;
        server_name  localhost;

        #charset koi8-r;

        access_log  logs/host.access.log  main;
	
	gzip  on;
	gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
	
	root        D:\Server\vue\details-web\dist;#vue项目的打包后的dist

        location / {
            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
            index  index.html index.htm;
        }

	location @router {
        	rewrite ^.*$ /index.html last;
   	 }

    	location ^~ /physics/ {
        	proxy_pass              http://192.168.100.225:8080;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/physics/(.+?)$ /$1 break;
    	}
	location ^~ /echarts/ {
        	proxy_pass              http://101.201.234.108:28888;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/echarts/(.+?)$ /$1 break;
    	}
	location ^~ /img/ {
        	proxy_pass              http://192.168.20.225:8080;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/img/(.+?)$ /$1 break;
    	}
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
    server {
        listen       8890;
        server_name  localhost;

        #charset koi8-r;

        access_log  logs/host.access.log  main;
	
	root        D:\Server\vue\photo-view-web\photoView;#vue项目的打包后的dist

        location / {
            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
            index  index.html index.htm;
        }

	location @router {
        	rewrite ^.*$ /index.html last;
   	 }
	location ^~ /img/ {
        	proxy_pass              http://192.168.20.225:8080;
        	proxy_set_header        Host            $host;
        	proxy_set_header        X-Real-IP       $remote_addr;
        	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        	client_max_body_size    20m;
        	client_body_buffer_size 128k;
        	proxy_buffers           32 4k;
        	proxy_connect_timeout   3;
        	proxy_send_timeout      30;
        	proxy_read_timeout      30;
		
		rewrite ^/img/(.+?)$ /$1 break;
    	}
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


}
