server { listen 80; server_name www.1.com www.a.com www.b.com; if ($host != 'www.a.com' ) { rewrite ^/(.*)$ http://www.a.com/$1 permanent; } index index.html index.htm index.php; root /data/www; # location /uc_server/ { # auth_basic "Auth"; # auth_basic_user_file /usr/local/nginx/conf/.htpasswd; # } location ~ \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name; } # location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ # { # expires 30d; # access_log off; # } location ~ .*\.(js|css)?$ { expires 12h; access_log off; } location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$ { expires 10d; valid_referers none blocked server_names *.1.com *.a.com *.b.com *.baidu.com\ *.google.com *.google.cn *.soso.com ; if ($invalid_referer) { return 403; #rewrite ^/ http://www.example.com/nophoto.gif; } access_log off; } access_log /home/logs/discuz.log combined_realip; }