nginx负载均衡&文件服务器配置&虚拟目录&代理&refer防盗链
2015-12-29 14:40
555 查看
1、负载均衡,/usr/local/nginx/nginx.conf添加stream即可
alias是一个目录别名的定义,root则是最上层目录的定义。还有一个重要的区别是alias后面必须要用“/”结束,否则会找不到文件的。。。而root则可有可无~~
4、refer防盗链https://help.aliyun.com/knowledge_detail/6708458.html?pos=2
5、重定向到某个地址
http{ .... }
stream { server { listen 8080 reuseport; proxy_pass netty; } upstream netty { server 192.168.180.68:8080; server 192.168.180.69:8080; } }2、添加文件服务器,在http中(如果性能不行,可参考http://blog.csdn.net/b_h_l/article/details/17508499)
server { listen 80; server_name 192.168.180.67;
location / { root /opt/test; index index.php index.html index.htm; autoindex on; autoindex_exact_size off; autoindex_localtime on; } }3、虚拟目录()
server { listen 80; server_name localhost; location / { root /404.html; index index.php index.html index.htm; } location /recfile { alias /home/netrec/; index index.php index.html index.htm; autoindex on; autoindex_exact_size off; autoindex_localtime on; } location /test { proxy_pass http://ip:port; } }
nginx的root和alias指令的区别
nginx配置下有两个指定目录的执行,root和aliaslocation /img//var/www/image/
location /img//var/www/image
alias是一个目录别名的定义,root则是最上层目录的定义。还有一个重要的区别是alias后面必须要用“/”结束,否则会找不到文件的。。。而root则可有可无~~
4、refer防盗链https://help.aliyun.com/knowledge_detail/6708458.html?pos=2
5、重定向到某个地址
server { listen 9000; server_name www.abc.com; rewrite ^/(.*)$ http://180.133.180.198:9002/$1 permanent; }
相关文章推荐
- 小心服务器内存居高不下的元凶--WebAPI服务
- 运维入门
- Seafile Server本地权限提升漏洞(CVE-2014-5443)
- 从USB安装Ubuntu Server 10.04.3 图文详解
- Java IO与NIO的一些文件拷贝测试
- Linux5.9无人值守安装
- 数据中心和云未来的十二大趋势
- 使用zabbix监控Nginx活动状态--Part1
- 高效访问Internet-启用ISA Server的缓存
- 用vsftp快速搭建ftp服务器
- Linux快速构建apache web服务器
- 服务器监控策略浅谈
- windows server域用户提升到本地更高权限组中的方法
- 如何降低服务器采购成本 原理分析
- 完美解决SQL Server 安装问题:以前的某个程序安装已在安装计算机上创建挂起的文件操作
- 建议的服务器分区办法
- IIS 错误 Server Application Error 详细解决方法
- 服务器托管六大优势分析
- 在WINXP系统上安装SQL Server企业版的方法