Skip to content
Advertisement

Nginx(proxy) + Apache: two process listening same port

I have two servers on CentOS: Nginx(proxy) + Apache. I need restart Nginx but if i try to test configuration before restart, i have next error:

[root@vm5808 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
nginx: configuration file /etc/nginx/nginx.conf test failed

How i can solve this problem? Thanks!

P.S. Nginx has listen port 80, apache listen 81.

Advertisement

Answer

I don’t know why this error has appeared, but after I made

[root@vm5808 ~]# /etc/init.d/nginx stop  
Stopping nginx:                                            [  OK  ]
[root@vm5808 ~]# /etc/init.d/nginx start
Starting nginx:                                            [  OK  ]

error has gone:

[root@vm5808 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

I’ve tried restart before stop and start, but Nginx wouldn’t restart:

[root@vm5808 ~]# /etc/init.d/nginx restart
nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
nginx: configuration file /etc/nginx/nginx.conf test failed
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement