Nginx和Lighttpd的Rewrite差别

简单的说,其实没啥差别,关键的一点,记住下面几个Nginx的Flags:
last – 基本上都用这个Flag。
break – 中止Rewirte,不在继续匹配
redirect – 返回临时重定向的HTTP状态302
permanent – 返回永久重定向的HTTP状态301

另外,有个东西很关键,曾经折腾我好几个小时才搞定,就是Nginx里面配置 {m,n} 这样的正则规则的时候,条件必须加上双引号,否则总是报错无法通过,官方文档里面真是很难找到这些东西,很晕。

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
5 Responses
  1. finalbsd says:

    不错,Michael这个经验值得分享,虽然我用Nginx和Lighttp不多,呵呵,我绝大部分服务器还是Apache,一直担心某些功能在这些新的服务器上无法满足,还有稳定性也是我作为核心服务器的一个最大需求。正考虑是否在核心服务上也使用Nginx和lighttpd,不知michael有什么高见。

  2. Michael says:

    [Comment ID #29689 Will Be Quoted Here]

    放心使用吧,youtube使用的是lighttpd,毫无问题,国内外若干网站使用着,Nginx经过实际测试,不会比lighttpd差,都可以放心使用,从我的经验来看,都比apache好使 🙂 也许是因为我对apache 掌握不够透彻才有此片面的看法。

  3. 25hours says:

    实际经验证明,在配置较差的机器,或者目前运行apache,但是load较高的机器上,使用nginx可能明显感受到性能的提升

  4. lpfrx says:

    如果 nginx 有 apache 的.htacess文件就方便了,不用每次改规则都要 restart

  5. ning says:

    没必要restart的,加个参数就可以了,自动加载配置的。具体参数忘记了,自己–help吧

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image