##
# 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.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		root /var/www/html/iops-ow;
		try_files $uri $uri/ =404;
	}
}

server {
        listen 18080 default_server;
        listen [::]:18080 default_server;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                root /var/www/html/iops-ow;
                try_files $uri $uri/ =404;
        }
}

server {
        listen 8000 default_server;
        listen [::]:8000 default_server;

        # index index.html index.htm index.nginx-debian.html;

        server_name _;

	    location /api {

          proxy_pass http://localhost:9080;

          # 设置请求头
          proxy_set_header x-forwarded-for $remote_addr;
        }
        
	    # 历史静态资源，纯本地
        location /oos/ {
                root /var/www/html/iops-frontend;
        }
        # MinIO 桶 alg-mvp，读写都走这里
        location /minio/ {
                client_max_body_size 5m;
                proxy_request_buffering off;
                proxy_buffering off;
                rewrite ^/minio/(.*)$ /alg-mvp/$1 break;
                proxy_pass http://127.0.0.1:19000;
                proxy_set_header Host 10.10.41.20:19000;
                proxy_set_header X-Real-IP $remote_addr;
        }

        location / {
                root /var/www/html/iops-frontend;
                index index.html index.htm index.nginx-debian.html;
                try_files $uri $uri/ /index.html;
                        # try_files $uri $uri/ =404;
        }
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#	listen 80;
#	listen [::]:80;
#
#	server_name example.com;
#
#	root /var/www/example.com;
#	index index.html;
#
#	location / {
#		try_files $uri $uri/ =404;
#	}
#}
