Hi Dushantha,

As you have mentioned apache2 is already bounded to port 80. that is why
when you try to start the nginx you are getting " Address already in use".
If you try stop the apache2 and start the nginx, you will be able to start
the nginx without the above error

Regards
Senduran

On Wed, Nov 29, 2017 at 12:49 PM, Dushantha Batuwita <dushan...@wso2.com>
wrote:

> Hi Senduran:
>
> I have tried your command and it is the apache2 process.
>
> sudo netstat -nlp | grep :80
> tcp6       0      0 :::80                   :::*
> LISTEN      1076/apache2
>
>
>
>
> further, *when I try installing the nginx freshly* the following error
> can be seen too (with details I have mentioned in the above mail)
>
> නෙවැ 29 12:31:07 dushantha-ThinkPad-X1-Carbon-5th nginx[8144]: nginx:
> [emerg] bind() to [::]:80 failed (98: Address already in use)
> නෙවැ 29 12:31:07 dushantha-ThinkPad-X1-Carbon-5th nginx[8144]: nginx:
> [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
> නෙවැ 29 12:31:07 dushantha-ThinkPad-X1-Carbon-5th nginx[8144]: nginx:
> [emerg] bind() to [::]:80 failed (98: Address already in use)
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th nginx[8144]: nginx:
> [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th nginx[8144]: nginx:
> [emerg] bind() to [::]:80 failed (98: Address already in use)
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th nginx[8144]: nginx:
> [emerg] still could not bind()
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
> nginx.service: Control process exited, code=exited status=1
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th systemd[1]: Failed to
> start A high performance web server and a reverse proxy server.
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
> nginx.service: Unit entered failed state.
> නෙවැ 29 12:31:08 dushantha-ThinkPad-X1-Carbon-5th systemd[1]:
> nginx.service: Failed with result 'exit-code'.
> dpkg: error processing package nginx-core (--configure):
>  subprocess installed post-installation script returned error exit status 1
> dpkg: dependency problems prevent configuration of nginx:
>  nginx depends on nginx-core (<< 1.10.3-1ubuntu3.1.1~) | nginx-full (<<
> 1.10.3-1ubuntu3.1.1~) | nginx-light (<< 1.10.3-1ubuntu3.1.1~) |
> nginx-extras (<< 1.10.3-1ubuntu3.1.1~); however:
>   Package nginx-core is not configured yet.
>   Package nginx-full is not installed.
>   Package nginx-light is not installed.
>   Package nginx-extras is not installed.
>  nginx depends on nginx-core (>= 1.10.3-1ubuntu3.1) | nginx-full (>=
> 1.10.3-1ubuntu3.1) | nginx-light (>= 1.10.3-1ubuntu3.1) | nginx-extras (>=
> 1.10.3-1ubuntu3.1); however:
>   Package nginx-core is not configured yet.
>   Package nginx-full is not installed.
>   Package nginx-light is not installed.
>   Package nginx-extras is not installed.
>
> dpkg: error processing package nginx (--configure):
>  dependency problems - leaving unconfigured
> No apport report written because the error message indicates its a
> followup error from a previous failure.
>
>                                 Processing triggers for ureadahead
> (0.100.0-20) ...
> Processing triggers for ufw (0.35-5) ...
> Errors were encountered while processing:
>  nginx-core
>  nginx
> E: Sub-process /usr/bin/dpkg returned an error code (1)
>
> Kindly advice if I have done something incorrect here
>
> Regards
>
>
> On Wed, Nov 29, 2017 at 11:21 AM, Senduran Balasubramaniyam <
> sendu...@wso2.com> wrote:
>
>> 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 <dushan...@wso2.com>
>> 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 <senu...@wso2.com>
>>> wrote:
>>>
>>>> Hi Dushantha,
>>>>
>>>> Its seems your port is already used. Please check on it again
>>>>
>>>> Thanks,
>>>>
>>>> *Senuwan Withana*
>>>> Software Engineer - Support Team | WSO2
>>>>
>>>> Email : senu...@wso2.com
>>>> Mobile: 94773212853
>>>> Web: http://www.wso2.com
>>>>
>>>>
>>>>
>>>> On Tue, Nov 28, 2017 at 5:09 PM, Dushantha Batuwita <dushan...@wso2.com
>>>> > 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
>>>>> dushan...@wso2.com
>>>>> mobile : 0094777453010
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> *Dushantha Nayanajith Chandima Batuwita*
>>> Software Engineer Support | WSO2
>>> dushan...@wso2.com
>>> mobile : 0094777453010
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> 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 <+94%2077%20952%206548>
>>
>
>
>
> --
> *Dushantha Nayanajith Chandima Batuwita*
> Software Engineer Support | WSO2
> dushan...@wso2.com
> mobile : 0094777453010
>



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

Reply via email to