alay 发表于 2012-3-30 14:29:13

老大们,帮我看看我的conf配置,是否正确

主要需要实现的目的:
1、http://abc.com自动转换成http://www.abc.com
2、http://abc.com/1.html 自动转换成http://www.abc.com/1.html
3、未定义域名访问都跳转到www,如http://222.abc.com/1.html自动转换成http://www.abc.com/1.html
4、不影响其他自定义的,如ftp.abc.com

server
{
listen       80;
server_name abc.com www.abc.com;
index index.html index.htm index.php default.html default.htm default.php;
                if ($host != 'www.abc.com' ) {
                     rewrite ^/(.*)$ http://www.abc.com/$1 permanent;
                                             }
            
root/home/wwwroot/alay/abc.com;
include wordpress.conf;
location ~ .*\.(php|php5)?$
   {
    fastcgi_passunix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }
location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
access_log off;
}

server
{
listen       80;
server_name ftp.abc.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/ftp;
location ~ .*\.(php|php5)?$
   {
    fastcgi_passunix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }
location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
access_log off;
}

server
      {
               listen       80;
               server_name*.abc.com;
               rewrite ^/(.*)$ http://www.abc.com/$1 permanent;
      }

licess 发表于 2012-3-30 18:52:49

可以
页: [1]
查看完整版本: 老大们,帮我看看我的conf配置,是否正确