nginx.conf的问题

时间:2011-06-20 00:50:02

标签: nginx

这是我第一次使用nginx,我在配置nginx.conf文件时遇到了一些问题。我拥有的是

server {
    location ~ /(application|system) {
        deny all;
        return 404;
    }

    rewrite  ^(.*)$  /index.php/$1  break;
}

如果不清楚;我正在尝试阻止访问目录应用程序和系统,并重写对index.php的所有其他请求。我尝试使用ian@ubuntu:~$ sudo nginx -t -c path_to_conf_file验证nginx.conf文件,但获取[emerg]: unknown directive "server"...。我可能做错了什么想法?

1 个答案:

答案 0 :(得分:14)

如果我记得,你需要确保服务器指令在http指令内。

例如:

http {

    //various nginx settings here

    server {
        //server stuff here
    }

}
相关问题