nginx alias
A path to the file is constructed by merely adding a URI to the value of the root directive. If a URI has to be modified, the alias directive should be used
| Syntax: | alias |
|---|---|
| Default: | — |
| Context: | location |
Defines a replacement for the specified location. For example, with the following configuration
location /i/ {
alias /data/w3/images/;
}
on request of “/i/top.gif”, the file /data/w3/images/top.gif will be sent.
The path value can contain variables, except $document_root and $realpath_root.
If alias is used inside a location defined with a regular expression then such regular expression should contain captures and alias should refer to these captures (0.7.40), for example:
location ~ ^/users/(.+\.(?:gif|jpe?g|png))$ {
alias /data/w3/images/$1;
}
When location matches the last part of the directive’s value:
location /images/ {
alias /data/w3/images/;
}
it is better to use the root directive instead:
location /images/ {
root /data/w3;
}
nginx alias的更多相关文章
- Nginx设置alias实现虚拟目录 alias与root的用法区别
Nginx 貌似没有虚拟目录的说法,因为它本来就是完完全全根据目录来设计并工作的.如果非要给nginx安上一个虚拟目录的说法,那就只有alias标签比较"像",干脆来说说alias ...
- nginx root、alias、location指令使用方法
一.nginx root指令 1. Nginx配置 相关配置如下图: 通过配置root目录到"/wwwroot/html/"位置 在用虚拟主机方法,主机名称是test,需要大家配置 ...
- 你真的了解nginx重定向URI?-rewrite和alias指令
未经允许不得转载!最近发现有博主转载我的文章,并没有跟我打招呼,也没有注明出处!!!! 熟悉Nginx的同学都知道Nginx可以用来做负载均衡和反向代理,非常好用.做前后端分离也是非常的方便. 今天我 ...
- 一个nginx匹配很诡异的问题
nginx配置如下: location ~ \.php$ { root /opt/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index inde ...
- nginx安装以及调优
目录: 1.安装nginx 2.配置nginx 3.调优nginx 4.性能测试 ps:为了方便,文档使用docker容器来操作的. 1.安装nginx 1.1 启动容器.download nginx ...
- Django+Nginx+uwsgi搭建自己的博客(五)
在上一篇博文中,向大家介绍了Users App和Index的前端部分的实现,以及前端与Django的通信部分.至此,我们的博客已经具备一个简单的雏形,可以将其部署在本地的服务器上了.目前较为流行的we ...
- history路由模式下的nginx配置
路由模式 众所周知,浏览器下的单页面应用的路由模式有下面两种: hash 模式和 history 模式.hash 模式通用性好,而且不依赖服务器的配置,省心省力,但是缺点是不够优雅.相比于 hash ...
- Nginx目录文件列表显示
项目中使用了tomcat,Nginx,测试阶段,生产阶段经常会有些bug需要调查.需要有些日志管理工具,在没有ELK的情况下,可以通过配置nginx来实现基本的日常查看.不需要登录到Linux服务器上 ...
- [Php][linux][nginx] 安装总结
就想总结一份安装环境文档,因为文档很多问题也很多,总结一份自己的安装文档! 首先,环境CentOS7,linux环境,windows! 1. 网络配置! vi /etc/sysconfig/netwo ...
随机推荐
- 无法解决 equal to 运算中 "Chinese_PRC_CI_AS" 和 "Latin1_General_100_CI_AS" 之间的排序规则冲突。
问题 操作临时表时提示如下排序规则冲突错误 sql ....忽略...sql ..... 无法解决 equal to 运算中 "Chinese_PRC_CI_AS" 和 " ...
- 对JSON数据的解析(数据推送接口)
package com.liuqi.www; import java.util.HashMap; import java.util.Map; import org.springframework.st ...
- C#动态创建lambda表达式
/// <summary> /// 创建lambda表达式:p=>true /// </summary> /// <typeparam name="T&q ...
- 【学习笔记】--- 老男孩学Python,day16-17 初识面向对象,类名称空间,查询顺序,组合
面向过程 VS 面向对象 面向过程的程序设计的核心是过程(流水线式思维),过程即解决问题的步骤,面向过程的设计就好比精心设计好一条流水线,考虑周全什么时候处理什么东西. 优点是:极大的降低了写程序的复 ...
- LINUX创建LVM、PV、VG、LV ORACLE服务器方案划分
为裸盘分区 查看硬盘分区 fdisk -l 进入分区管理 fdisk /dev/sda 创建PV 创建PV pvcreate /dev/sda1 pvcreate /dev/sdb1 pvcreate ...
- css的元素表现
块级元素和行内元素的表现: 块级元素:块级元素和父元素的宽度一致,默认情况下就是和body的宽度一样,也可以说和浏览器窗口的宽度一致,致使同一行不能再放下另外的元素,所以块级元素表现为独占一行. 块级 ...
- opencv图像处理时使用stringstream批量读取图片,处理后并保存
简介: 同文件输入输出流一样,使用stringstream可以批量读取图片,处理后并进行保存.因为C++中头文件 stringstream既可以从string读数据也可向string写数据,利于其这个 ...
- C# 新建文档CreateNewDocument
// Copyright 2010 ESRI// // All rights reserved under the copyright laws of the United States// and ...
- Spring Boot—04文件上传
package com.smartmap.sample.ch1.controller.view; import java.io.File; import java.io.IOException; im ...
- Postman Postman接口测试工具使用简介
Postman接口测试工具使用简介 by:授客 QQ:1033553122 本文主要是对Postman这个接口测试工具的使用做个简单的介绍,仅供参考. 插件安装 1)下载并安装chrome浏览器 2) ...