Nginx将所有请求转向同一个host

准备只保留 (sunliwen.com) 这一个域名,但因为有些外链,所以加一条rewrite来兼容。

# Redirect all requests to sunliwen.com
if ($host != sunliwen.com) {
    rewrite ^(.*)$ http://sunliwen.com$1 permanent;
}

参考:

标签: ,

  • http://beijingcode.org xuedi

    Good info,

    i need to change to nginx as well, apache keeps getting more and more slow …

    Greeting from Germany
    雪地

    • http://sunliwen.com Liwen

      I don’t have chance to wait apache got slow. Running several other stuff on the same VPS, only Nginx could save me. :)