nginx.conf的问题

blc*_*llo 4 nginx

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

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

    rewrite  ^(.*)$  /index.php/$1  break;
}
Run Code Online (Sandbox Code Playgroud)

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

kni*_*eli 14

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

例如:

http {

    //various nginx settings here

    server {
        //server stuff here
    }

}
Run Code Online (Sandbox Code Playgroud)