server {

listen 4200;

server_name localhost;

location ~* \.(html)$ {

root /opt/public;

add_header Cache-Control no-store;

}

location ~* \.(js|css|map|jpg|png|svg|ico)$ {

root /opt/public;

add_header Cache-Control "public,max-age=2592000";

}

location /index.html{

root /opt/public;

}

location / {

add_header Access-Control-Allow-Origin *;

add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, DELETE, PUT';

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

root /opt/public;

try_files $uri $uri/ /index.html;

index index.html index.htm Default.htm;

}

location /status {

stub_status on;

}

location /health {

default_type text/html;

return 200 "It is ok";

}

}

}

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐