您当前的位置: 首页 >  cmmboy1990 nginx

vuecli项目打包放在nginx服务中

cmmboy1990 发布时间:2021-11-26 10:01:24 ,浏览量:3

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;
	 }
关注
打赏
1688896170
查看更多评论

cmmboy1990

暂无认证

  • 3浏览

    0关注

    131博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0346s