2010-11-26 59 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 ... 
    } 
}