如何使用Leverage浏览器为angular app编写nginx conf文件

时间:2018-01-26 14:10:28

标签: angular docker nginx browser dockerfile

构建角度应用后,

当我运行docker文件时,我无法加载页面,

在我的控制台里面,它给了我这个警告:

enter image description here

这是我的nginx-custom.conf文件:

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    self.extensionContext?.widgetLargestAvailableDisplayMode = NCWidgetDisplayMode.expanded


}

func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) {
    if activeDisplayMode == NCWidgetDisplayMode.compact {
        //compact
        self.preferredContentSize = maxSize
    } else {
        //extended
        self.preferredContentSize = CGSize(width: 0, height: 200)
    }
}

DockerFile:

server {
   listen 80;
   location / {
   root /usr/share/nginx/html;
   index index.html index.htm;
   try_files $uri $uri/ /index.html =404;
   }
   location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
       expires 365d;
   }
}

1 个答案:

答案 0 :(得分:0)

# Expires map
  map $sent_http_content_type $expires {
  default                    off;
  text/html                  epoch;
  text/css                   max;
  application/javascript     max;
  ~image/                    max;
  }

  server {
  listen 80;
  location / {
  root /usr/share/nginx/html;
  index index.html index.htm;
  try_files $uri $uri/ /index.html =404;
  }
 }

这里是参考url