0%

nginx

“server” directive is not allowed here

错误1.1

报错信息:

1
nginx: [emerg] "server" directive is not allowed here in /opt/nginx23/conf/nginx.conf:101

错误代码:

1
2
3
4
5
6
7
server {
listen 80;
server_name www.s26linuxav.com;
location / {
root /tmp/py/html/linuxav;
index index.html index.htm;
}

错误原因:

此代码位于 nginx 的配置文件 /opt/nginx23/conf/nginx.conf 中,server 的大括号没有封闭。

解决方法:

加上回括号

1
2
3
4
5
6
7
8
server {
listen 80;
server_name www.s26linuxav.com;
location / {
root /tmp/py/html/linuxav;
index index.html index.htm;
}
}