[转]nginx虚拟目录(alias与root的区别)
server_name test.com;
charset utf-8,GB2312;
index index.html;
root html;
access_log logs/access.log main;
}
root /home/awstats/;
index index.html;
access_log off;
error_log off;
charset gb2312;
}
server_name test.com;
charset utf-8,GB2312;
index index.html;
root html;
access_log logs/access.log main;
}
alias /home/;
index index.html;
access_log off;
error_log off;
charset gb2312;
}
server_name test.com;
charset utf-8,GB2312;
index index.html;
root html;
access_log logs/access.log main;
}
alias /home/awstats/;
index index.html;
access_log off;
error_log off;
charset gb2312;
}
server_name test.com;
charset utf-8,GB2312;
index index.html;
root html;
access_log logs/access.log main;
}
root /home/;
index index.html;
access_log off;
error_log off;
charset gb2312;
}
root /home/awstats/;
访问:http://test.com/awstats/ 实际访问的是/home/awstats/awstats/
alias /home/
alias /home/awstats/;
root /home/;
访问:http://test.com/awstats/ 实际访问的是/home/awstats/
借用ayou老师的一句话:
一般情况下,在location /中配置root,在location /other中配置alias是一个好习惯
[转]nginx虚拟目录(alias与root的区别)的更多相关文章
- Nginx虚拟目录alias和root目录
nginx是通过alias设置虚拟目录,在nginx的配置中,alias目录和root目录是有区别的:1)alias指定的目录是准确的,即location匹配访问的path目录下的文件直接是在alia ...
- Nginx设置alias实现虚拟目录 alias与root的用法区别
Nginx 貌似没有虚拟目录的说法,因为它本来就是完完全全根据目录来设计并工作的.如果非要给nginx安上一个虚拟目录的说法,那就只有alias标签比较"像",干脆来说说alias ...
- Nginx虚拟目录(alias)和根目录(root)
功能要求: 假设nginx配置的域名是www.kazihuo.com,现有静态资源/home/www/oye目录需要通过nginx访问. 功能实现: 前提要求: 1.在nginx.conf中到处第二行 ...
- Nginx虚拟目录设置
location ~ .*\.html$ 匹配所有以.html结尾的链接 --------------------------------------------------------- 关于a ...
- Nginx 虚拟目录和虚拟主机的配置
nginx.conf 配置文件的几个常用命令 nginx 配置文件主要分为六个区域: main: 全局设置 events: nginx工作模式 http: http设置 sever: 主机设置 loc ...
- nginx虚拟目录实现两个后台使用
购买了阿里云机器,准备搭建一套备份的后台,由于资源有限所以将两个后台搭建到一组SLB下的两台WEB上. 使用软件:NGINX+PHP root@xx conf.d]# yum install php- ...
- Nginx(alias 和 root的区别)
Nginx(alias 和 root的区别)1.alias 和 root 的区别: location /request_path/image { root /local_path/image/; } ...
- nginx“虚拟目录”不支持php的解决办法
这几天在配置Nginx,PHP用FastCGI,想装一个phpMyAdmin管理数据库,phpMyAdmin不想放在网站根目录 下,这样不容易和网站应用混在一起,这样phpMyAdmin的目录就放在别 ...
- nginx的alias与root的区别
root的写法: location /request_path/image/ { root /local_path/image/; } 这样配置的结果就是当客户端请求 /request_path/im ...
随机推荐
- hdu 4679 Terrorist’s destroy 树的直径+dp
题意:给你一棵树,每条边都有值W,然后问你去掉一条边,令val = w*max(两颗新树的直径),求val最小值~ 做法,先求树的直径,然后算出直径上每个点的最长枝条长度.这样对于每一条边,假如是枝条 ...
- 在Linux下安装JDK环境
解压java安装包到指定目录下,这里为/data/software/java/, 然后在/etc/profile添加以下内容: JAVA_HOME =/data/software/java/jdk1. ...
- poj2771
题解: 二分图最大独立及 每两个不能选的渐变 输出n+m-最大匹配 代码: #include<cstdio> #include<cmath> #include<algor ...
- MATLAB基础知识tips
网络论坛资源: MATLAB中文论坛https://i.cnblogs.com/EditPosts.aspx?opt=1 circshift 移位函数,circshift(A,SHIFTSIZE).S ...
- getaddrinfo()详解
IPv4中使用gethostbyname()函数完成主机名到地址解析,但是该API不允许调用者指定所需地址类型的任何信息,返回的结构只包含 了用于存储IPv4地址的空间.为了解决该问题,IPv6中引入 ...
- vue--踩坑
1.通过computed计算属性,计算过的值,假如传递给子组件,在子组件中修改是不起作用的.
- 图像和流媒体 -- Sapera 安装遇到的问题
一.下载安装包 参看:Genie Nano M1930-NIR 点击软件及例程下载 二.安装遇到的问题 (1)Installation directory must be on a local har ...
- Java8安装配置
方法1.命令行安装 -jdk 存在多个版本,自动配置: sudo update-alternatives --config java 方法2.下载安装 下载java8的jdk http://www.o ...
- 理解Scala中的Extractor
引言 最近抱着<Programming in Scala>(英文第二版)在死啃Scala.在阅读第26章Extractor时,偶然在Stack Overflow上搜到一个帖子<Sca ...
- Linux libusb 安装及简单使用
Linux libusb 安装及简单使用 一.参考文档: . libusb1 fails do_configure task with “udev support requested but libu ...