nginx 配置示例

71 阅读1分钟
server {
    listen 80;

    location ^~ /ats-api/ {
        proxy_pass http://localhost:10001/ats-api/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location ^~ /operation-api/ {
        proxy_pass http://localhost:10002/operation-api/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location ^~ /operation-tool-api/ {
        proxy_pass http://localhost:20001/operation-tool-api/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    } 

	location ^~ /service-brain-api/ {
        proxy_pass http://localhost:10010/service-brain-api/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }	

    


    location ^~ /operation-tool/ {
   	  root   /usr/share/nginx/html;
    	  try_files $uri $uri/ /operation-tool/index.html;
   	    
    }
   
    location ^~ /operation/ {
          root   /usr/share/nginx/html;
          try_files $uri $uri/ /operation/index.html;
    }

    location ^~ /ats/ {
          root   /usr/share/nginx/html/;
          try_files $uri $uri/ /ats/index.html;
    }    

    location ^~ /service-brain/ {
	  root   /usr/share/nginx/html/;
          try_files $uri $uri/ /service-brain/index.html;
    }

}