[root@web01 default]# /app/server/nginx/sbin/nginx -t nginx: [emerg] unknown directive "if(!-e" in /app/server/nginx/conf/vhosts/default.conf:11 nginx: configuration file /app/server/nginx/conf/nginx.conf test failed [root@web01 default]# grep "if" /app/server/nginx/conf/vhosts/default.conf if(!-e $request_filename) location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ #原因是if 与 () 之间必需要有空格!! [root@web01 default]# /app/server/nginx/sbin/nginx -t nginx: the configuration file /app/server/nginx/conf/nginx.conf syntax is ok nginx: configuration file /app/server/nginx/conf/nginx.conf test is successful [root@web01 default]# grep "if" /app/server/nginx/conf/vhosts/default.conf if (!-e $request_filename) location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$