Nginx配置文件分为好多块,常见的从外到内依次是「http」、「server」、「location」等等,缺省的继承关系是从外到内,也就是说内层块会自动获取外层块的值作为缺省值。
root和alias的区别
当用户访问http://ip:port/nginx/qunying/helloword.jsp时,nginx上可以进行如下配置:
location /nginx/qunying/ {
alias /home/qunying.liu/;
}
实际访问的文件是:/home/qunying.liu/helloword.jsp
或
location /nginx/qunying/ {
root /home/;
}
实际访问的文件是:/home/qunying/helloword.jsp
在location /中配置root,在location /other中配置alias,推荐如此配置
nginx的目录浏览功能:
在server里加上如下三行即可。
autoindex on;
autoindex_localtime on;
autoindex_exact_size off;
nginx登录验证:
在location段内添加:
auth_basic "phoenix slb admin ";
auth_basic_user_file /data/appdatas/phoenix-slb-passwd;
最后说下:
nginx与tengine
官网介绍:http://tengine.taobao.org/
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。
我们的软负载实际上是基于tengine 开发的,个人认为 tengine实际上就是nginx,只不过功能比nginx多,属于Nginx的超集。
当然,我们的科普之路才刚刚开始,更多的还需要大家自行研究,快乐往往都是自找的。
书籍推荐:
《深入理解nginx:模块开发与架构解析》 作者:陶辉 阿里巴巴资深nginx技术专家
参考资料:
http://blog.youkuaiyun.com/syhd142/article/details/8440667
http://blog.youkuaiyun.com/yankai0219/article/details/8018275
http://blog.youkuaiyun.com/yankai0219/article/details/8018232
http://www.cppblog.com/converse/archive/2009/05/13/82879.html
http://www.alidata.org/archives/1208
http://www.oschina.net/translate/nginx-setup
转载于:https://blog.51cto.com/steven2/1439312