首页 > 系统相关 >vue启用https服务及nginx启用https配置

vue启用https服务及nginx启用https配置

时间:2023-08-09 17:45:53浏览次数:38  
标签:index vue nginx 启用 ssl html proxy https

1.vue开发环境中主要是configjs配置 启用https服务

devServer: {
    https: true, //启用https
}

 2.nginx  申请一个ssl证书 ,自行申请。  下面是一个nginx例子  需要修改的配置https主要是红色标出来部分。蓝色加粗部分主要是history模式下 刷新出现404的解决办法

server {

    listen       11091 ssl;
    server_name  ssl;
    ssl_certificate       C:/test/nginx-1.21.3/ssl/test.crt;
    ssl_certificate_key  C:/test/nginx-1.21.3/ssl/test.key;
    gzip_static on;
     ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;
    
    location /api/ {
        proxy_pass http://127.0.0.1:11004/;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";

        proxy_set_header Host $http_host;
        proxy_cookie_path /api /;
    }    
        

    
    location / {    
        root ../static/dist/;
        try_files $uri $uri/ /index.html; //避免刷新404  一般路由为history时候
        index  index.html index.htm;
    }


    location @router {
        rewrite ^.*$ /index.html last;
    }

    error_page  404              /404.html;
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

 

标签:index,vue,nginx,启用,ssl,html,proxy,https
From: https://www.cnblogs.com/zhupanpan/p/17617482.html

相关文章

  • vue3 + vite + vue-router 4.x项目在router文件中使用pinia报错
    1.背景vue-router4.x版本,想在路由文件中引入并使用pinia后报错如下:表面意思是getActivePinia()方法在pinia还没有激活的时候被调用,导致报错。2.解决方法在stores文件夹下新建pinia.js文件,用来引入并创建pinia实例。import{createPinia}from"pinia";const......
  • vue excel导入 补充校验
    前台校验<template><div><el-dialog:title="'校验'":close-on-click-modal="false"append-to-body:before-close="handleClose"v-if="visible":visible.sync="visib......
  • 在vue2 v-bind中使用console.log
    <el-submenuv-for="(item,index)inmenuList":key="index":index="console.log(item.name)||item.name"> main.jsVue.prototype.console=console 参考:https://stackoverflow.com/questions/51......
  • 智慧工地源码,基于Vue+Spring Cloud +UniApp框架开发
    源码技术架构:微服务+JavaVue+SpringCloud+UniApp+MySql智慧工地管理平台是依托物联网、互联网、AI、可视化建立的大数据管理平台,是一种全新的管理模式,能够实现劳务管理、安全施工、绿色施工的智能化和互联网化。智慧工地管理平台功能包括:劳务实名制管理系统、监测系统、区域安......
  • vite+vue 在html中通过script引入的文件在使用时,部署后却无法获取文件中的方法
    今天在写项目的时候,遇到了一个奇怪的问题,我再html中使用script全局引入了一个js文件,但是在组件中使用window.xxx的时候却报错了,说没有这个方法,在本地几次测试都是好的。报错前相关版本:"@vitejs/plugin-vue-jsx":"^2.0.0","@vitejs/plugin-vue":"^2.2......
  • vue+el-tree 通过下拉框选中节点,定位到当前节点,并高亮
    此处为下拉选择器:<el-selectref="searchSelect"v-model="filter"filterableremotesize="mini"clearableplaceholder="请输入关键词":remo......
  • vue import 调用方法 Import是javascript中的一种模块加载方式,在Vue中也可以使用impor
    vueimport调用方法Import是javascript中的一种模块加载方式,在Vue中也可以使用import来加载组件、库或其他模块。使用import语句,可以将需要的模块导入到当前模块的作用域中,以使其可用于当前模块内的执行。原文链接:https://www.yzktw.com.cn/post/1248672.htmlImport是javascri......
  • vs2017 启用自带 反编译功能
    打开此功能后,我们就可以查看dll文件源码了vs2017需要手动打开设置-选项vs2022已经默认打开了,不需要我们单独设置 ......
  • ubuntu22.04问题:Method https has died unexpectedly!
    问题当我们执行update的时候,有时候会遇到下面这种情况apt-getupdate命中:1http://mirrors.tuna.tsinghua.edu.cn/ubuntujammyInRelease命中:2http://mirrors.tuna.tsinghua.edu.cn/ubuntujammy-updatesInRelease命中:3http://mirrors.tuna.tsinghua.edu.cn/ubuntuj......
  • vue3 + ElementPlus 封装函数式弹窗组件
    需求场景:弹窗组件需要支持自定义的插槽内容,删除的弹窗也要使用这个组件,只是样式不一样而已,希望在父组件使用删除弹窗的时候直接调用某个方法就可以显示弹窗组件模拟cuDialog假设我的弹窗组件有以下的props和事件dialogVisible:控制弹窗显示和隐藏title:弹窗的标题showClose......