2010-11-26 65 views
3

这里是我的代码(从第35行):nginx的:未知的指令 “位置”

location/

{ 

    index index.php; 
    root /home/body; 

    if ($request_filename !~ (js|css|images|robots\.txt|index\.php.*)) { 
    rewrite ^/(.*)$ /index.php/$1 last; 
    } 
} 

以下是错误:

[emerg]: unknown directive "location" in /opt/nginx/conf/nginx.conf:35 

谁能帮助如何解决这一问题?提前致谢。

+0

请告诉我的

nginx -V
我想输出,你的nginx与
--without-http
选项建造。 – CyberDem0n 2010-11-26 04:23:50

回答

13

确保位置指令位于服务器模块内:

http { 
... 
    server { 
     ... 
     location ... 
    } 
}