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 ...
随机推荐
- Node.js链式回调
由于异步的关系,代码的书写顺序可能和执行顺序并不一样,可能想先执行A再执行B,但由于异步可能B要先于A执行.例如在OC中使用AFnetworking请求数据然后刷新页面,由于网络请求是用block实现 ...
- 12.Reflect
Reflect Reflect 概述 Reflect对象与Proxy对象一样,也是 ES6 为了操作对象而提供的新 API.Reflect对象的设计目的有这样几个. (1) 将Object对象的一些明 ...
- [转]How to nest transactions nicely - "begin transaction" vs "save transaction" and SQL Server
本文转自:http://geekswithblogs.net/bbiales/archive/2012/03/15/how-to-nest-transactions-nicely---quotbegi ...
- Ionic APP 热更新
开门见山,本文主题:cordova-hot-code-push 作用:cordova热更新插件,提供了在应用程序中对基于Web的内容进行自动更新的功能. GitHub地址:https://github ...
- WinForm 多语言处理
多语言处理工具我使用的是 SailingEase .NET Resources Tool ,好处是导出一个Excel,把具体翻译工作交给专业的人来做,翻译ok后再导入,缺点就是后续更改麻烦,添加一个 ...
- tr循环,每行 2个数相加 求出和位第三个数赋值 (http://jsfiddle.net/hgeL44rz/113/)
<table id="tb"> <tr> <th>单价</th> <th>数量</th> <th> ...
- 面试1 SQL SERVER 查询第20行到30之间的数据
SQL SERVER 查询第20行到30之间的数据 1.先查询前20行的ID,后查询除去20条记录的前10条记录 SELECT TOP 10 * FROM tbBank WHERE BankID NO ...
- @Value失效的问题
@Value 会在@Controller中失效,失效原因涉及源码问题就不一一叙述了,一般加上@Service,@Component就能解决.如果是在Controller中使用建议新建一个配置类,然后在 ...
- Java虚拟机基础知识你知道多少?
http://www.cnblogs.com/qlky/p/7401841.html java虚拟机结构 http://liuwangshu.cn/java/jvm/1-runtime-data-ar ...
- mysql 优化海量数据插入和查询性能
对于一些数据量较大的系统,数据库面临的问题除了查询效率低下,还有就是数据入库时间长.特别像报表系统,每天花费在数据导入上的时间可能会长达几个小时或十几个小时之久.因此,优化数据库插入性能是很有意义的. ...