我正在设置一个Nginx前端服务器,以便在不同的端口(例如8080和8081)上运行两个节点应用程序。我正在关注Nginx docs for configuring multiple virtual private servers,但是当我放置http {}语法时,Nginx会抛出错误。
Restarting nginx nginx
...fail!
以下是代码:
http {
# Configuration specific to HTTP and affecting all virtual servers
server {
# configuration of virtual server 1
location /one {
# configuration for processing URIs with '/one'
}
location /two {
# configuration for processing URIs with '/two'
}
}
server {
# configuration of virtual server 2
}
}
当删除http {}时,nginx不会产生任何错误。
Restarting nginx nginx
...done
我目前正在运行nginx版本:nginx / 1.4.6(Ubuntu)。 有人可以解释为什么会这样吗?