sudo service nginx restart 错误的问题,系统是 ubuntu - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
tin
V2EX    Linux

sudo service nginx restart 错误的问题,系统是 ubuntu

  •  
  •   tin 2017-11-08 00:22:47 +08:00 7182 次点击
    这是一个创建于 2895 天前的主题,其中的信息可能已经有所发展或是发生改变。
    错误提示:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    运行 systemctl status nginx.service 提示如下:

    Nov 07 16:17:40 ip-172-31-28-177 systemd[1]: Starting A high performance web server and a reverse proxy server...
    Nov 07 16:17:40 ip-172-31-28-177 nginx[10083]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
    Nov 07 16:17:40 ip-172-31-28-177 nginx[10083]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Nov 07 16:17:40 ip-172-31-28-177 systemd[1]: nginx.service: Control process exited, code=exited status=1
    Nov 07 16:17:40 ip-172-31-28-177 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    Nov 07 16:17:40 ip-172-31-28-177 systemd[1]: nginx.service: Unit entered failed state.
    Nov 07 16:17:40 ip-172-31-28-177 systemd[1]: nginx.service: Failed with result 'exit-code'.

    网上搜了很久,说是少了一个 ";",但我检查了两次,没有少分号。请高手指教是什么问题?谢谢
    9 条回复    2017-11-12 18:19:44 +08:00
    crazycen
        1
    crazycen  
       2017-11-08 00:27:42 +08:00 via iPhone
    大哥,你这系统不是 ubuntu 吧!
    expy
        2
    expy  
       2017-11-08 00:28:22 +08:00
    you should increase server_names_hash_bucket_size: 64
    然后谷歌出的是:
    http {
    server_names_hash_bucket_size 64;
    ...
    }

    可以用 ngingx -t 测试配置文件。
    GreenVine
        3
    GreenVine  
       2017-11-08 00:29:45 +08:00
    善用 Google: https://github.com/nginxinc/kubernetes-ingress/issues/34

    > set server-name-hash-bucket-size: "1024" in the configMap
    zjp
        4
    zjp  
       2017-11-08 00:31:52 +08:00 via Android
    贴一下 /etc/nginx/nginx.conf 文件和 sudo nginx -t 的运行结果
    crazycen
        5
    crazycen  
       2017-11-08 00:40:33 +08:00 via iPhone
    提示配置文件有错误,你最小化配置文件重启试试!
    flynaj
        6
    flynaj  
       2017-11-08 13:55:41 +08:00 via Android
    配置文件出错,对比老的好好看看,有没有用到全角符号之类的
    tin
        7
    tin  
    OP
       2017-11-08 19:22:02 +08:00
    @zjp
    nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
    nginx: configuration file /etc/nginx/nginx.conf test failed
    zjp
        8
    zjp  
       2017-11-08 19:47:30 +08:00 via Android   1
    #2 #3 的方法应该可以了吧 报错里的重点就是 "you should increase server_names_hash_bucket_size" hash 桶不够,设置成 128
    huayun
        9
    huayun  
       2017-11-12 18:19:44 +08:00
    虚拟主机配置文件出错了,可以到 /etc/nginx/sites-enabled 目录下,把里面的软链接文件逐个删除,没删除一个,重启下 nginx ;如果哪个删后,nginx 可以重启成功了,就说明是哪个配置文件出错了,把那个仔细检查下,最后一定记得把删除后的软链接配置文件重新都加上去
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1555 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 32ms UTC 16:17 PVG 00:17 LAX 09:17 JFK 12:17
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86