
#user  nobody;
worker_processes  2;



events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 20m; 

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

  add_header Access-Control-Allow-Origin *;
   add_header Access-Control-Allow-Headers X-Requested-With;
   add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
   add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Access-Control-Allow-Origin,Authorization';

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
upstream mysvr {   
        server 127.0.0.1:20001  weight=1 max_fails=2 fail_timeout=30s;           
            } 
    server {
        listen       443;
        server_name  5sxc.com www.5sxc.com;
        access_log  logs/web.log  main;
        ssl on; 
        ssl_certificate       /opt/nginx/conf/cert/ssl/full_chain.pem;
        ssl_certificate_key   /opt/nginx/conf/cert/ssl/private.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
location /wss {
      proxy_pass http://127.0.0.1;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "Upgrade";                  
         proxy_redirect default;                 
         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;
              }

     location /sx_api/ {
      proxy_pass http://47.242.93.239/opt/gamesx/;                  
         proxy_redirect default;                 
         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;
              }
     location /lobby_api/ {
         proxy_pass http://47.242.93.239:20001/dsgame_lobby/;                  
         proxy_redirect default;                 
         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;
              }
     location /dsgame_admin/ {
      proxy_pass http://47.242.93.239:20010/dsgame_admin/;                  
         proxy_redirect default;                 
         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;
              }
     location /login_api/ {
         proxy_pass http://47.242.93.239:20001/dsgame_login_api/;                  
         proxy_redirect default;                 
         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;
              }
     location /apple_api/ {
         proxy_pass http://47.242.93.239:20031/dsgame-pay-api/;
         proxy_redirect default;
         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;
              }
     location /apple_api/aliExchange/ {
         proxy_pass http://47.242.93.239:20031/dsgame_pay_api/aliExchange/; 
         proxy_redirect default;                 
         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;
              }
     location /apple_api/exchangePay/ { 
         proxy_pass http://47.242.93.239:20031/dsgame_pay_api/exchangePay/;                  
         proxy_redirect default;                 
         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;
              }
     location /permission_api/ {
         proxy_pass http://47.242.93.239:20010/permission_web/;
         proxy_redirect default;
         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;
              }

    }

    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
	location /sx_api/ {
	 proxy_pass http://47.242.93.239/opt/gamesx/;                  
         proxy_redirect default;                 
         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;
              }
	location /lobby_api/ {
	    proxy_pass http://47.242.93.239:20001/dsgame_lobby/;                  
         proxy_redirect default;                 
         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;
              }
	location /dsgame_admin/ {
	 proxy_pass http://47.242.93.239:20010/dsgame_admin/;                  
         proxy_redirect default;                 
         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;
              }
	location /login_api/ {
	    proxy_pass http://47.242.93.239:20001/dsgame_login_api/;                  
         proxy_redirect default;                 
         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;
              }
	location /apple_api/ {
	    proxy_pass http://47.242.93.239:20031/dsgame-pay-api/;
         proxy_redirect default;
         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;
              }
	location /apple_api/aliExchange/ {
	    proxy_pass http://47.242.93.239:20031/dsgame_pay_api/aliExchange/; 
         proxy_redirect default;                 
         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;
              }
	location /apple_api/exchangePay/ { 
	    proxy_pass http://47.242.93.239:20031/dsgame_pay_api/exchangePay/;                  
         proxy_redirect default;                 
         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;
              }
	location /permission_api/ {
         proxy_pass http://47.242.93.239:20010/permission_web/;
         proxy_redirect default;
         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;
              }

    }

}
