nginx笔记

upstream data_front{ 
server 172.25.25.25:8080; 
} 

server {
  listen 9099;
  server_name localhost;

  root /usr/front/;
  index index.html index.htm;

  location / {
  try_files $uri $uri/ /index.html;
  }

  location ~ /(root|manager|user|screen|userInfo|login)/ {
  proxy_pass http://data_front;   // 默认情况下需要配置 
  proxy_set_header Host $http_host;  // 默认情况下需要配置


  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Access-Control-Allow-Origin *;
  proxy_set_header Access-Control-Allow-Headers "Origin,X-Requested-With,Content-Type,Accept";
  client_max_body_size 100m;
  } 

  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root html;
  }
}
location / {
            root root/front;
            index index.html index.htm;
            try_files $uri $uri/ /index.html;
        }

 

posted @ 2020-09-07 16:39  笑言哑哑  阅读(134)  评论(0编辑  收藏  举报