location if (.....) #if与中括号之间要有空格

 

[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)$

 

posted @ 2016-08-01 12:08  bass  阅读(682)  评论(0编辑  收藏  举报