
#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;
    client_max_body_size 10m;
    #gzip  on;
    upstream gateways {
        server 172.16.2.76:8003;
        server 172.16.2.78:8003;
    }

    server {
        listen       80;
        server_name  http://172.16.2.78;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /www/dist/;
            index  index.html index.htm;
        }

        location /yygkpt/ {
             proxy_pass http://gateways/;
        }

        location /webroot/{
        	  return 307 http://172.16.2.78/fr$request_uri;
        }

        location /fr/ {
             proxy_pass http://172.16.1.56:8080/;
             add_header Access-Control-Allow-Origin *;
             add_header Access-Control-Allow-Headers X-Requested-With;
             add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
             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;
             client_max_body_size 10m;
             client_body_buffer_size 128k;
             proxy_buffers           32 4k;
             proxy_connect_timeout   600;
             proxy_send_timeout      600;
             proxy_read_timeout      600;
        }

        location /oa {
            alias  /www/oa/;
            index  index.html index.htm;
        }

        location ^~ /release/ {
            alias /release/;
            sendfile on;   # 开启高效文件传输模式
            autoindex on;  # 开启目录文件列表
            autoindex_exact_size on;  # 显示出文件的确切大小，单位是bytes
            autoindex_localtime on;  # 显示的文件时间为文件的服务器时间
            charset utf-8,gbk;  # 避免中文乱码
        }
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  www.yuanxisoft.com;

     #   ssl on;
     #   ssl_certificate      /www/yuanxisoft.com_bundle.pem;
     #   ssl_certificate_key  /www/yuanxisoft.com.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
     #   ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
     #   ssl_prefer_server_ciphers  on;



      #  location / {
	#    add_header Access-Control-Allow-Credentials true;
	#    add_header Access-Control-Allow-Origin *;
	#    add_header Access-Control-Allow-Methods *;
	#    add_header Access-Control-Allow-Headers *;

	#    if ($request_method = 'OPTIONS') {
	#	return 200;
	#    }

         #   proxy_pass https://www.yuanxisoft.com:8003/;
         #   proxy_set_header   Host             $host;
         #   proxy_set_header   X-Real-IP        $remote_addr;
         #   proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
      #  }
   # }

}
