1.8 nginx域名跳转

server
{
 listen 80;
 server_name www.test.com;
if ($host !='www.test.com')
   {
     rewrite ^/(.*)$ http://www.test.com/$1 permanent;
   }
 index index.html index.htm index.php;
 root /data/www;
 location ~ .*admin\.php$ {
   auth_basic "wyclinux auth";
   auth_basic_user_file   /usr/local/nginx/conf/.htpasswd;
     include fastcgi_params;
     fastcgi_pass unix:/tmp/php-fcgi.sock;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
# /usr/local/nginx/sbin/nginx –t
# /etc/init.d/nginx reload     //重新加载nginx


你可能感兴趣的:(1.8 nginx域名跳转)