nginx 配置301转发

   1. 设置域名解析

    daijun.me 指向 234.33.22.21

  2.主机234.33.22.21 nginx配置 转发 

 
 server {
    listen 80;
    server_name daijun.me www.daijun.me;
    access_log /data/wwwlogs/access_nginx.log combined;
   # root /data/wwwroot/default;
   # index index.html index.htm index.php;
    if ($host = 'daijun.me' ) {
      rewrite ^/(.*)$ http://www.cnblogs.com/wangdaijun/$1 permanent;
    }
    if ($host = 'www.daijun.me' ) {
      rewrite ^/(.*)$ http://www.cnblogs.com/wangdaijun/$1 permanent;
     }
}
location 语法规则

http://www.cnblogs.com/lidabo/p/4169396.html

http://wiki.nginx.org/NginxHttpCoreModule#location

 



posted @ 2016-03-17 19:09  托马斯布莱克  阅读(1536)  评论(0编辑  收藏  举报