Question

Failed to start nginx on ubuntu 16.04 server

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:/# 

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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