Report this

What is the reason for this report?

Failed to start nginx on ubuntu 16.04 server

Posted on June 17, 2020
root@ip-172-31-11-69:/# systemctl status nginx.service 
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2020-06-17 03:24:27 UTC; 18min ago

Jun 17 03:24:27 ip-172-31-11-69 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 17 03:24:27 ip-172-31-11-69 nginx[20727]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
Jun 17 03:24:27 ip-172-31-11-69 nginx[20727]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 17 03:24:27 ip-172-31-11-69 systemd[1]: nginx.service: Control process exited, code=exited status=1
Jun 17 03:24:27 ip-172-31-11-69 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jun 17 03:24:27 ip-172-31-11-69 systemd[1]: nginx.service: Unit entered failed state.
Jun 17 03:24:27 ip-172-31-11-69 systemd[1]: nginx.service: Failed with result 'exit-code'.
root@ip-172-31-11-69:/# 


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

In the /etc/nginx/nginx.conf file update the http block to include the following

http {
    ...
    server_names_hash_bucket_size 64;
    ...
}

Test your configuration with nginx -t

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.