• vue-router+nginx非根路径的配置方法


    一、直接配置在根路径下

    直接配置在根路径下,访问的时候只用输入http://1.15.179.248:8089(这边没有域名用ip代替),在nginx的配置如下

     二、非根路径配置

    如果一个域名下有多个项目,那么使用根路径配置就不合适了,我们需要在根路径下指定一层路径,比如说

    后台管理系统admin

    http://1.15.179.248:8087/admin/

    配置如下

     代码

     server {
            listen       8087;
            server_name  1.15.179.248;
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location /admin {
                alias /data/admin-test/;  // 此处为admin项目放置的路径
                try_files $uri $uri/ /admin/index.html;
                index  index.html index.htm;
            }
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    }

    注意要用alias不能用root

    参考文章:https://www.php.cn/js-tutorial-406275.html

  • 相关阅读:
    java中日期格式的转换和应用
    struts2下载
    struts2上传
    div下拉框(待改善)
    jsp中jquery用法一步刷新 验证用户名是否存在
    react 解析json
    babel-polyfill 解决浏览器兼容
    页面跳转缓存 keepAlive
    webpack知识点
    element-ui upload
  • 原文地址:https://www.cnblogs.com/qdlhj/p/15305205.html
Copyright © 2020-2023  润新知