##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##



server {
	listen       80;
        listen  [::]:80;
        server_name  localhost;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	location / {
		try_files $uri $uri/ /index.html;
		error_page 405 =200 $uri;
		index index.html;
		root /usr/share/nginx/html;
	}
	location /api/account/ {
		proxy_http_version 1.1;
		proxy_pass http://tvememberuser.default.svc.cluster.local:2099;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Host tvememberuser.default.svc.cluster.local;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
	location /api/goods/ {
		proxy_http_version 1.1;
		proxy_pass http://tvememberproduct.default.svc.cluster.local:2098;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Host tvememberproduct.default.svc.cluster.local;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
	location /api/payment/ {
		proxy_http_version 1.1;
		proxy_pass http://tvememberbill.default.svc.cluster.local:2094;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Host tvememberbill.default.svc.cluster.local;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
	location /api/order/ {
		proxy_http_version 1.1;
		proxy_pass http://tvememberbill.default.svc.cluster.local:2094;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Host tvememberbill.default.svc.cluster.local;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}

