When the nginx service is started, the following message is displayed: Address already in use.

Source: Internet
Author: User

During LNMP, The nginx service was started and cannot be enabled. As a result, the web page cannot be opened. The following error message is displayed when starting the service:

Starting nginx: [emerg] bind () to 0.0.0.0: 80 failed (98: Address already in use)

Nginx: [emerg] bind () to 0.0.0.0: 80 failed (98: Address already in use)
Nginx: [emerg] bind () to 0.0.0.0: 80 failed (98: Address already in use)
Nginx: [emerg] bind () to 0.0.0.0: 80 failed (98: Address already in use)
Nginx: [emerg] bind () to 0.0.0.0: 80 failed (98: Address already in use)
Nginx: [emerg] still cocould not bind ()

Problem description: The address is already in use. The nginx service may be stuck, causing port occupation. This error occurs.

Solution: first, use lsof: 80 to check which program occupies port 80. Lsof returns the following results:

Command pid user fd type device size/OFF NODE NAME
Nginx 3274 root 6u IPv4 10664 0t0 TCP *: http (LISTEN)
Nginx 3547 nginx 6u IPv4 10664 0t0 TCP *: http (LISTEN)

It was found that it was an nginx program, so we dropped the nginx service k and restarted the service .. The command is as follows:

Kill-9 3274

Kill-9 3547

Service nginx start

Starting nginx: [OK]

OK. The service is started successfully !~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.