栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

vuecli项目打包放在nginx服务中

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

vuecli项目打包放在nginx服务中

1.前提如果web项目部署在 根目录下 即 /,需要同时启动两个项目即 web项目和h5项目
2。配置文件设置

location / {
	    root   D:/nginx2/dist/;
      index  index.html index.htm;
	    try_files $uri $uri/ /index.html;
	    autoindex on;       #开启nginx目录浏览功能
      autoindex_exact_size off;   #文件大小从KB开始显示
      charset utf-8;          #显示中文
      add_header 'Access-Control-Allow-Origin' '*'; #允许来自所有的访问地址
      add_header 'Access-Control-Allow-Credentials' 'true';
      add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS'; #支持请求方式
      add_header 'Access-Control-Allow-Headers' 'Content-Type,*';	                
   }

	  #H5
	  location /h5 {
	  alias    D:/h5/dist/;
	  index    index.html index.htm;
	  try_files $uri $uri/ /h5/index.html;
	 }
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/599497.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号