Why Nginx is not properly working in CentOS7, Can any one suggest me

April 9, 2018 444 views
DigitalOcean Deployment Nginx CentOS

[root@localhost bin]# nginx -t
**nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@localhost bin]# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]: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:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]: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:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]: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:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]: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:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[root@localhost bin]# systemctl status nginx.service

Error:
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2018-04-09 16:35:28 IST; 6min ago
Process: 22654 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 22597 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 22595 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Apr 09 16:35:27 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Apr 09 16:35:27 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Apr 09 16:35:28 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] still could not bind()
Apr 09 16:35:28 localhost.localdomain systemd[1]:Failed to start The nginx HTTP and reverse proxy server.
Apr 09 16:35:28 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Apr 09 16:35:28 localhost.localdomain systemd[1]: nginx.service failed.

** I checked so many time but result is same, same error message i getting again and again.
Nginx testing is ok ,running aslo but at the time of running on browser i not getting any message, and after i checked the status of Nginx i get above message... so what i can do...**

2 Answers

Have you also installed another web server like Apache? The errors here indicate that ports 80 and 443 are already in use on your droplet by another service.

No, I'm not using Apache.........
Steps whatever i have did...

  1. Node
  2. WebRTC (MCU)
  3. Nginx

My MCU is working ...

[root@localhost Release-v3.4]# ls
audio_agent     bin              extras  NOTICE  package.json  recording_agent  sip_agent   ThirdpartyLicenses.txt  webrtc_agent
avstream_agent  cluster_manager  logs    nuve    portal        session_agent    sip_portal  video_agent
[root@localhost Release-v3.4]#
[root@localhost Release-v3.4]#
[root@localhost Release-v3.4]# cd bin
[root@localhost bin]# ls
daemon.sh  detectOS.sh  epel-release-latest-7.noarch.rpm  init-all.sh  init-mongodb.sh  init-rabbitmq.sh  restart-all.sh  start-all.sh  stop-all.sh
[root@localhost bin]# ./start-all.sh
nuve running as process 19238.
cluster-manager running as process 19320.
portal running as process 19358.
session-agent running as process 19397.
webrtc-agent running as process 19457.
avstream-agent running as process 19517.
sip-agent running as process 19576.
recording-agent running as process 19640.
audio-agent running as process 19700.
video-agent running as process 19762.
sip-portal running as process 19829.
app running as process 19871.
[root@localhost bin]# cat /home/raviranjan/Release-v3.4/logs/woogeen-app.stdout
1 rooms in this service.
MyRoom Id: 5aaa48e9258bfc717b77b808

After that I'm doing to test my Nginx It's also fine but when I am trying to reload my Nginx Server its going to Failed...

I already mention about what is my Error!

Have another answer? Share your knowledge.