- angularjs glup 发布使用base href的时候需要注意打包项目的href和src前面不要加/
- 形如
<link rel="stylesheet" href="distribution/css/style-bbf5185ccf.min.css">
<script src="distribution/js/lib-bundle-9c0d3f4a4c.min.js"></script>
<script src="distribution/html/templates-fe5af67be9.js"></script>
<script src="distribution/js/fi-bundle-f19136ea85.min.js"></script>
否则可能会报错
Resource interpreted as Stylesheet but transferred with MIME type text/html
如果是使用nginx,在xxxx.nginx.conf当中使用alias去寻找路径
如果不使用base href,网站发布的域名直接是:域名.com/项目路径
nginx,在xxxx.nginx.conf当中把alias替换成root
nginx指定文件路径有两种方式root和alias,指令的使用方法和作用域:
[root]
语法:root path
默认值:root html
配置段:http、server、location、if
[alias]
语法:alias path
配置段:location
ref
root与alias主要区别在于nginx如何解释location后面的uri,这会使两者分别以不同的方式将请求映射到服务器文件上。
root的处理结果是:root路径+location路径
alias的处理结果是:使用alias路径替换location路径
alias是一个目录别名的定义,root则是最上层目录的定义。
还有一个重要的区别是alias后面必须要用“/”结束,否则会找不到文件的