server { listen 80 ; server_name test.com www.test.com; index index.html index.php index.htm; root /alidata/www/test/public/; if ( $query_string ~* ".*[;'<>].*" ){ return 404; } return 404; } location / { try_files $uri $uri/ /index.php?$query_string; } if (!-f $request_filename){ rewrite ^/(.+)$ /index.php?$1& last; } location ~ .*.(php|php5)?$ { if ( $host != 'test.com' ) { rewrite ^/(.*)$ http://test.com permanent; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*.(js|css)?$ { expires 1h; } access_log /alidata/log/nginx/access/default.log; }