首页 > 其他 > 详细

nginx: [emerg] "upstream" directive is not allowed

时间:2018-05-08 16:17:45      阅读:4247      评论:0      收藏:0      [点我收藏+]
配置完nginx,在启动的时候遇到如下问题:
nginx: [emerg] "upstream" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:7

配置nginx.conf,如下:
upstream con {
    server 127.0.0.1:8080;
}


解决办法:

upstream backend 位置放错了, upstream位置应该放在http模块里面 但必须是在server模块的外面


http
{
    include mime.types;
    default_type application/octet-stream;
    server_names_hash_bucket_size 3526;
    server_names_hash_max_size 4096;
    ..................................................

    upstream con {
    server 127.0.0.1:8080;
}

}
对此段代码放入httpd模块中,重启服务可完成问题的解决。

nginx: [emerg] "upstream" directive is not allowed

原文:http://blog.51cto.com/sf1314/2114019

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!