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 ...
随机推荐
- [转]RDL Report in Visual Studio New page per Record
本文转自:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f58cd5cf-4296-40f0-b3c8-7e4e15d73762/r ...
- 监测代码执行时间之Stopwatch
var sw = new System.Diagnostics.Stopwatch(); sw.Start(); 中间为要执行的代码 sw.Stop(); var msg = "上面操作耗时 ...
- 同一个网站下不同应用程序可以不同Framework版本
管理应用程序,高级设置,应用程序池可以改成不同的
- BG.Hive - part1
1. Hive架构 What is hive? Facebook,https://en.wikipedia.org/wiki/Apache_Hive a> 一种工具,可以通过SQL轻松的访问数据 ...
- 项目托管到Github上
一.注册github账号 首先需要注册一个github账号,注册地址:https://github.com 接着会来到这 然后会收到一封github发的邮件,进入邮箱验证 二.创建个人的githu ...
- 【基于初学者的SSH】struts2 值栈的详解与struts2标签库+ognl表达式
一:什么是值栈:struts2里面本身提供的一种存储机制,类似于域对象,值栈,可以存值和取值 特点:先进后出,最上面的元素叫做栈顶,也叫压栈. <s:debug></s:debug& ...
- SSM(Spring+SpringMVC+Mybstis)搭建,写给新手
SSM框架——详细整合教程(Spring+SpringMVC+MyBatis) 作用: SSM框架是spring MVC ,spring和mybatis框架的整合,是标准的MVC模式,将整个系统划分为 ...
- MySQL的数据控制语言DCL
我们使用DDL的"CREATE USER"语句创建用户,新的SQL用户不允许访问属于其他SQL用户的表,也不能立即创建自己的表,它必须被授权.可以授予的权限包括以下几组: 1.列权 ...
- C# NPOI 导出Execl 工具类
NPOI 导出Execl 自己单独工具类 详见代码 using System; using System.Collections.Generic; using System.Linq; using S ...
- Windows下Sqlplus中显示乱码
set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK 如果想显示英文 Set nls_lang=american_america.zhs16gbk 注意,前提是 ...