当前位置:网站首页>关于localtion 下的root和alias的区别
关于localtion 下的root和alias的区别
2022-07-28 16:38:00 【Ripo_za】
这篇文章写的很好。https://www.cnblogs.com/my_life/articles/7070805.html
下面是该文章的内容
我实际应用
我要访问 C:\javaweb\apache-tomcat-8.5.45\apache-tomcat-8.5.45\webapps\ROOT目录下的index.html文件。下面是分别介绍使用root和alias如何配置localtion。

假设 server_name 是www.abc.com
1、使用root
location /ROOT{
root "C:/javaweb/apache-tomcat-8.5.45/apache-tomcat-8.5.45/webapps";
index index.html;
}
上面代码中
1、location 后面必须为root路径下面的子目录名,也可以是 /
2、# 路径的双引号加不加都可以
3、路径的斜杠可以反着也可以,就是这样
C:\javaweb\apache-tomcat-8.5.45\apache-tomcat-8.5.45\webapps
访问时通过 www.abc.com/ROOT访问
2、使用alias
location /home{
alias C:/javaweb/apache-tomcat-8.5.45/apache-tomcat-8.5.45/webapps/ROOT/;
index index.html;
}
1、下面home哪里可以写成任意的值,作为代理的“虚拟路径”。
访问时通过 www.abc.com/home访问
边栏推荐
- 7-8 浪漫侧影(25分)建树+新解题思路
- 【Unity FPS】教程 | 使用Unity制作第一人称角色控制器
- Tips--SCI论文写作中的小技巧
- [阅读笔记]-2 通过朴素贝叶斯模型学习机器学习分类
- 点云处理---kd-tree
- MySQL optimization summary
- [unity FPS] tutorial | using unity to make a first person character controller
- 电工学自学笔记1.21
- 2022 idea (student email authentication) installation and use tutorial and basic configuration tutorial
- 【p5.js学习笔记】局部变量(let)与全局变量(var)声明
猜你喜欢

Tips--解决No module named matlab.engine的问题

2022 IDEA (学生邮箱认证)安装使用教程以及基础配置教程

IO的操作

如何安装ps的滤镜插件
@Detailed explanation of requestmapping

mmdetection3d(2)---结果、log可视化
![[machine learning notes] regularization: ridge regression](/img/94/9d1e126554fac0713937381253f9c9.png)
[machine learning notes] regularization: ridge regression

Understanding of virtual (virtual method) in C and its difference from abstract (abstract method)

Complete MySQL interview questions (updated in succession)

Sql Server STUFF与FOR XML PATH
随机推荐
[unity] three pictures let you understand the shadergraph editor
Encapsulation, inheritance, polymorphism
MySQL basic queries and operators
Mmdetection3d (3) -- network output
【Unity】Sprite九宫格到底怎么玩?
Collection collection
概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别
Understanding of virtual (virtual method) in C and its difference from abstract (abstract method)
进程、线程、信号量和互斥锁
OpenMV(五)--STM32实现人脸识别
2022 IDEA (学生邮箱认证)安装使用教程以及基础配置教程
封装、继承、多态
【p5.js学习笔记】局部变量(let)与全局变量(var)声明
1.4-dos
Three ways to dynamically call WebService.Net
How to upload a project to the code cloud using idea
Grid in pytorch_ How to use sample
@Detailed explanation of requestmapping
[C language note sharing] - dynamic memory management malloc, free, calloc, realloc, flexible array
点云处理---kd-tree