• Nginx打开目录浏览功能(autoindex)

    日期:

    Nginx默认是不允许列出整个目录的。如需此功能, 打开nginx.conf文件,在location server 或 http段中加入 autoindex on; //我测试只这一条就成功 另外两个参数最好也加上去: autoindex_exact_size off; 默认为on,显示出文件的确切大小,单位是bytes。 改为...

  • nginx --upstream iphash

    日期:

    一般做负载均衡,都需要后端多台web服务器之间实现session共享,否则用户登录可能就有问题了。 今天看nginx文档时候,发现nginx可以根据客户端IP进行负载均衡,在upstream里设置ip_hash,就可以针对同一个C类地址段中的客户端选择同一个后端服务器,除非那个...

  • nginx rewrite规则

    日期:

    最近在VPS上尝试配置安装一个网站,VPS安装了LNMP(Linux+Nginx+MySQL+php)在配置重定规则的时候经常遇到一些问题,直接用Apache的规则到Nginx下没起作用。原来Apache 重写的规则到nginx上还有一些不太一样的地方。 原文地址:http://www.cnblogs.com/cgli/...

  • nginx做非80端口转发

    日期:

    nginx可以很方便的配置成反向代理服务器 影响版本(nginx-1.0.10): server { listen 80; server_name localhost; location / { proxy_passhttp://147.16.24.175:9500; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_se...

  • nginx+php的配置

    日期:

    http://www.cnblogs.com/jsckdao/archive/2011/05/05/2038265.html http://bd.hbrc.com/news/view_5934196.html http://www.itokit.com/2012/0318/73388.html php: ./configure --prefix=/usr/local/php \ --with-mysql=/usr/local/mysql \#设置mysql的安装路...

  • 配置nginx支持ssl sni (一个IP绑定多个证书)

    日期:

    让nginx支持多证书,nginx必须支持TLS SNI,使用命令/www/wdlinux/nginx/sbin/nginx -V查看,服务器的查看结果如下: nginx version: nginx/1.4.4 TLS SNI support disabled configure arguments: --prefix=.... .... 很明显,不支持TLS SNI,需要重新编译open...

  • nginx负载均衡器处理session共享的几种方法

    日期:

    1) 不使用session,换作cookie 能把session改成cookie,就能避开session的一些弊端,在从前看的一本J2EE的书上,也指明在集群系统中不能用session,否则惹出祸端来就不好办。如果系统不复杂,就优先考虑能否将session去掉,改动起来非常麻烦的话,再用下面的...

  • Nginx Chs VirtualHost Example

    日期:

    两个虚拟主机(纯静态-html 支持) - Two Virtual Hosts, Serving Static Files http { server { listen 80; server_name www.domain1.com; access_log logs/domain1.access.log main; location / { index index.html; root /var/www/domain1.com/htdocs; } }...

  • Nginx 根据访问终端跳转页面

    日期:

    server { server_name it.net.cn; listen 80; access_log off; location / { if ($http_user_agent ~ ((MIDP)|(WAP)|(UP.Browser)|(Smartphone)|(Obigo)|(Mobile)|(AU.Browser)|(wxd.Mms)|(WxdB.Browser)|(CLDC)|(UP.Link)|(KM.Browser)|(UCWEB)|(SEMC\-Brow...

  • Nginx不间断服务的平滑升级方法

    日期:

    版本是从正在服役的1.0.12升级到1.0.15。 第一步:备份旧版的Nginx和配置文件 cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/bak_nginx //备份旧版程序 cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/bak_nginx.conf //备份配置文件...