帝王谷资源网 Design By www.wdxyy.com
网上搜索Angular
项目编译后部署到 Nginx
中的方法,多数文章都介绍了需要在 Nginx
中的配置文件的 location
中特别指定跳转到首页来避免刷新导致404的问题,那么完整的server
代码是:
server { listen 80; server_name 192.168.190.131; #sendfile on; #charset koi8-r; access_log /var/log/nginx/host.access.log main; location / { root /chanchaw/app/angular; index index.html index.html; try_files $uri $uri/ /index.html; } error_page 404 /index.html; location = /index.html { root /chanchaw/app/angular; } }
上面的 server_name
后面是 CentOS7.3
的IP地址,后面的 location
中要特别注意:try_files $uri $uri/ /index.html
,这里是防止浏览器中刷新导致404,那么重点来了,部署到Nginx
后浏览器测试出现下面的问题:
明明index.html
和 js
文件是在同一个目录下为什么会找不到?chrome
这样,firefox
也这样,好吧,换换IE试试吧。
解决
原来chrome
和 firefox
都会自动将 http
转换为 https
来发出请求,而自己试验用的 CentOS
是安装在虚拟机中的,压根就没想过要部署 ssl
,由于 ie
不会转换协议,所以 ie
上测试是没问题的。
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
更新日志
2024年10月28日
2024年10月28日
- 群星2013-青春缤纷辑压箱宝大公开3CD2[新加坡限量版][WAV整轨]
- 林育群.2013-BalladShow(日本版)【环球】【WAV+CUE】
- 陈加洛.1992-痛到感觉不到【宝丽金】【WAV+CUE】
- 群星.2023-宿命之敌电视剧原声带【韶愔音乐】【FLAC分轨】
- 東京事変-大発見[FLAC+CUE]
- 椎名林檎-三文ゴシップ[FLAC+CUE]
- 2024年08月04日
- 裘德《裘德「最后的水族馆」演唱会LIVE》[320K/MP3][228.89MB]
- 裘德《裘德「最后的水族馆」演唱会LIVE》[24bit 48kHz][FLAC/分轨][2.08G]
- 基因三重奏《如果你什么都不说 音乐会现场录音》[320K/MP3][145.37MB]
- 孟庭苇.1996-月亮说话(2020环球24KGOLD限量版)【上华】【WAV+CUE】
- 群星.1997-新艺宝优质音响系列·国语精选监听版【新艺宝】【WAV+CUE】
- 阿桑.2005-寂寞在唱歌(星外星引进版)【华研国际】【WAV+CUE】
- 基因三重奏《如果你什么都不说 音乐会现场录音》[FLAC/分轨][287.43MB]
- 蔡题谦《我爱你,却依然要看你走》[320K/MP3][88.65MB]