
set_real_ip_from  0.0.0.0/0;
real_ip_header    X-Forwarded-For;

server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;
	charset utf-8;
    access_log  /var/log/nginx/access.log  main;
 
    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    
    location /download {
            alias  /usr/share/nginx/html;
            index  index.html;
    }
	
    location /localFile {
        alias   /opt;
        #autoindex on;
    }

    location /statics {
        alias   /home;
        #autoindex on;
    }

    location /demoPurchase {
        #client_max_body_size 1024m;
        #proxy_set_header REMOTE-HOST $remote_addr;
        #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_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
	proxy_pass http://192.168.0.30:32506;
    }

    location /api/v5.0/ {
        client_max_body_size 1024m;
           #proxy_set_header Host $http_host;
        #proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        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://192.168.0.30:32500/;
    }
    
    location /api/v5.0/socket/ {
        proxy_pass http://192.168.0.30:32500/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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_set_header   X-Forwarded-Host $Server_name;
        proxy_connect_timeout 12000s;
        proxy_read_timeout 36000s;
        proxy_send_timeout 36000s;
    }

    location / {
        #add_header Cache-Control no-store;
	    proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	    root   /usr/share/nginx/html;
        index  /web-base/browser/base.html index.htm;
	    #index /html/index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    
  location /preview/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    client_max_body_size 500m;
    proxy_redirect off;
    proxy_set_header x-scheme $scheme;
    proxy_pass http://192.168.0.30:32502/preview/;
  }

 location /nginx_status {
    stub_status;
    #allow 127.0.0.1;
    #deny all;
 }


}

