As the error says "Address already in use" you have to find which process
is bound to port 80 already. the following command will help you identify
the process running on port 80

sudo netstat -nlp | grep :80

find the process and stop that process first before trying to start the
nginx

Regards
Senduran

On Wed, Nov 29, 2017 at 11:06 AM, Dushantha Batuwita <[email protected]>
wrote:

> Hi
>
> I completely uninstall NGINX from my machine and reinstalled it again and
> but the NGINX server gives me the same error.
>
> *Things I have done*
>
>
>    - I have run the command
>
> sudo netstat -tulpn
>
> Active Internet connections (only servers)
> Proto Recv-Q Send-Q Local Address           Foreign Address         State
>      PID/Program name
> tcp        0      0 127.0.0.1:631           0.0.0.0:*
>  LISTEN      32365/cupsd
> tcp        0      0 0.0.0.0:389             0.0.0.0:*
>  LISTEN      1401/slapd
> tcp        0      0 0.0.0.0:3306            0.0.0.0:*
>  LISTEN      987/mysqld
> tcp        0      0 0.0.0.0:5355            0.0.0.0:*
>  LISTEN      976/systemd-resolve
> tcp6       0      0 ::1:631                 :::*
> LISTEN      32365/cupsd
> tcp6       0      0 :::389                  :::*
> LISTEN      1401/slapd
> tcp6       0      0 :::5355                 :::*
> LISTEN      976/systemd-resolve
> tcp6       0      0 :::80                   :::*
> LISTEN      1126/apache2
>
>
>    - Even I have killed the process 1126 and tried.
>
>
> Then searched the error on the net and found that the resource [1]  and
> change the /etc/nginx/sites-enabled/default   file by inserting the code
>
> listen [::]:80 ipv6only=on default_server; as it has been stated.
>
>
> [1] https://stackoverflow.com/questions/14972792/nginx-
> nginx-emerg-bind-to-80-failed-98-address-already-in-use
>
> but when I try starting the nginx and check the status the same error is
> shown.
> as bellow
>
> ● 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 2017-11-29 10:40:44 +0530;
> 35s ago
>      Docs: man:nginx(8)
>   Process: 13817 ExecStart=/usr/sbin/nginx -g daemon on; master_process
> on; (code=exited, status=1/FAILURE)
>   Process: 13816 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on;
> master_process on; (code=exited, status=0/SUCCESS)
>
> නෙවැ 29 10:40:43 dushantha-ThinkPad-X1-Carbon-5th nginx[13817]: nginx:
> [emerg] bind() to [::]:80 failed (98: Address already in use)
> නෙවැ 29 10:40:43 dushantha-ThinkPad-X1-Carbon-5th nginx[13817]: nginx:
> [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
> නෙවැ 29 10:40:43 dushantha-ThinkPad-X1-Carbon-5th nginx[13817]: nginx:
> [emerg] bind() to [::]:80 failed (98: Address already in use)
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th nginx[13817]: nginx:
> [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th nginx[13817]: nginx:
> [emerg] bind() to [::]:80 failed (98: Address already in use)
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th nginx[13817]: nginx:
> [emerg] still could not bind()
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
> nginx.service: Control process exited, code=exited status=1
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th systemd[1]: Failed to
> start A high performance web server and a reverse proxy server.
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
> nginx.service: Unit entered failed state.
> නෙවැ 29 10:40:44 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
> nginx.service: Failed with result 'exit-code'.
>
>
> If you have come across this kind of error please advice.
>
> Regards
>
>
>
>
> On Tue, Nov 28, 2017 at 5:17 PM, Senuwan Withana <[email protected]> wrote:
>
>> Hi Dushantha,
>>
>> Its seems your port is already used. Please check on it again
>>
>> Thanks,
>>
>> *Senuwan Withana*
>> Software Engineer - Support Team | WSO2
>>
>> Email : [email protected]
>> Mobile: 94773212853
>> Web: http://www.wso2.com
>>
>>
>>
>> On Tue, Nov 28, 2017 at 5:09 PM, Dushantha Batuwita <[email protected]>
>> wrote:
>>
>>> Hi Dev
>>>
>>> I have installed the nginx and when I try  starting the nginx, I
>>> receive following error.
>>>
>>>  sudo service nginx start
>>>
>>> Job for nginx.service failed because the control process exited with
>>> error code.
>>> See "systemctl  status nginx.service" and "journalctl  -xe" for details.
>>>
>>>
>>> when I check the status it gives me.
>>>
>>> ● 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 Tue 2017-11-28 16:33:48
>>> +0530; 50s ago
>>>      Docs: man:nginx(8)
>>>   Process: 953 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on;
>>> master_process on; (code=exited, status=1/FAILURE)
>>>
>>> නෙවැ 28 16:44:57 dushantha-ThinkPad-X1-Carbon-5th nginx[2996]: nginx:
>>> [emerg] bind() to [::]:80 failed (98: Address already in use)
>>> නෙවැ 28 16:44:58 dushantha-ThinkPad-X1-Carbon-5th nginx[2996]: nginx:
>>> [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
>>> නෙවැ 28 16:44:58 dushantha-ThinkPad-X1-Carbon-5th nginx[2996]: nginx:
>>> [emerg] bind() to [::]:80 failed (98: Address already in use)
>>> නෙවැ 28 16:44:58 dushantha-ThinkPad-X1-Carbon-5th nginx[2996]: nginx:
>>> [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
>>> නෙවැ 28 16:44:58 dushantha-ThinkPad-X1-Carbon-5th nginx[2996]: nginx:
>>> [emerg] bind() to [::]:80 failed (98: Address already in use)
>>> නෙවැ 28 16:44:59 dushantha-ThinkPad-X1-Carbon-5th nginx[2996]: nginx:
>>> [emerg] still could not bind()
>>> නෙවැ 28 16:44:59 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
>>> nginx.service: Control process exited, code=exited status=1
>>> නෙවැ 28 16:44:59 dushantha-ThinkPad-X1-Carbon-5th systemd[1]: Failed to
>>> start A high performance web server and a reverse proxy server.
>>> නෙවැ 28 16:44:59 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
>>> nginx.service: Unit entered failed state.
>>> නෙවැ 28 16:44:59 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
>>> nginx.service: Failed with result 'exit-code'.
>>>
>>>
>>>
>>>
>>> Is there any possible solution to get rid of the error
>>> regards
>>>
>>>
>>>
>>>
>>> --
>>> *Dushantha Nayanajith Chandima Batuwita*
>>> Software Engineer Support | WSO2
>>> [email protected]
>>> mobile : 0094777453010
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>
>
> --
> *Dushantha Nayanajith Chandima Batuwita*
> Software Engineer Support | WSO2
> [email protected]
> mobile : 0094777453010
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Senduran *
Senior Software Engineer,
WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
Mobile: +94 77 952 6548
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to