当前位置:网站首页>关于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访问
边栏推荐
- Complete MySQL interview questions (updated in succession)
- Mmdetection3d (3) -- network output
- [p5.js learning notes] basic knowledge of code drawing
- Mmdetection3d (2) -- visualization of results and logs
- 编译原理学习笔记1(编译原理概述与词法分析)
- 电工学自学笔记1.22
- Openpcd安装过程记录
- [p5.js learning notes] local variable (let) and global variable (VaR) declaration
- 概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别
- ROS零散知识点及错误解决
猜你喜欢

Technical aspects passed easily, HR: those with only three years of experience in large factories are not worth 20K

【p5.js】实战练习——无规则对称

MySQL installation

MySQL与IDEA连接

QT programming serial port assistant
@Detailed explanation of requestmapping

OpenMV(三)--实时获取摄像头图片

From 0 to 1: Development notes of voting applet based on cloud development

有奖征文 | 2022 云原生编程挑战赛征稿活动开启!

leetcode系统性刷题(一)-----链表、栈、队列、堆
随机推荐
ROS custom message and use
如何安装ps的滤镜插件
How to bind idea with code cloud
[advanced C language] - analyze the storage of micro data in memory [2] (floating point storage)
Jerry ac692n --- prompt tone compression and modification
Generation and use of dynamic link library (error summary)
Sql Server STUFF与FOR XML PATH
数字滤波器(六)--设计FIR滤波器
电工学下册自学笔记1.23
abstract、static、final
OpenMV(三)--实时获取摄像头图片
On the non recursive and recursive implementation of finding the nth Fibonacci number respectively
移动端overflow失效问题
[advanced C language] - function pointer
【Unity】三张图让你看懂ShaderGraph编辑器
MySQL的安装
.net MVC的理解
数字滤波器(五)--设计IIR滤波器
Grid in pytorch_ How to use sample
leetcode系统性刷题(五)-----动态规划