July 7, 2015

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080

Summary: In this post i tried to explain how to resolve the issue of apache bind address. The issue is Apache: could not bind to address to port (make_sock).
If you are going to upgrade server software, or sometime you try to make changes in the configurations files and you are restarting the apache. This time you Funk your Wang-alls.
Step-1: Check apache processes
ps -e | grep httpd
24215 ? 00:00:00 httpd
24217 ? 00:00:00 httpd
24218 ? 00:00:00 httpd
24219 ? 00:00:00 httpd
24220 ? 00:00:00 httpd
24221 ? 00:00:00 httpd
24222 ? 00:00:00 httpd
24223 ? 00:00:00 httpd
24224 ? 00:00:00 httpd
24225 ? 00:00:00 httpd
[root@imran~]# kill 24215
[root@imran ~]# kill 24215
-bash: kill: (21415) – No such process
[root@imran ~]# ps -e | grep httpd
[root@imran~]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
Step-2: Start apache service 
sudo /etc/init.d/apache2 start
* Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
Unable to open logs
…fail!
Apache is attempting to listen on port 8080, but can’t because it’s already in use. There are a few reasons why this might be happening.
Port configuration problem:
If you configure duplicate Listen Entries in ports.conf and apache.conf it will bother you.  So make sure you have single time entry in both files. either in apache.conf or in ports.conf. Other then that you have to check and confirm the apache.conf have single entry for ports.conf.
Listen 8080
#
# Listen 443
#Another service could be using the port
Step-3:I was ran to the same error because of apache another instance was already running. I used netstat, grep and kill the process and fix the problem.
# try to start apache, receive error
root@imran~: sudo /etc/init.d/apache2 start
* Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
Unable to open logs
…fail!
Step-4: See what applications using the port (note that I’m searching for :80, I could also use :8080)
root@imran~: sudo netstat -tulpn| grep :80
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 29004/apache2
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 28964/nginx
# I see that apache2 is using 8080! Kill it!
root@imran~: killall -9 apache2
# Let’s try again, with success
~: sudo /etc/init.d/apache2 start
* Starting web server apache2
…done.
All we have to check and follow where we have catch the problem rather than restarting services again and again. The better is to dig the issue evaluate and resolve it properly.
Hope this will help someone and will save time.

Related Posts:

  • Cài đặt và cấu hình syslog-ng trên CentOS 6Khái niệm facility level và secrity level:Facility level: đại diện cho đối tượng tạo ra thông báo (kernel, process). acility NumberKeywordFacility Description 0kemkernel messages 1useruser-level messages 2mailmail system 3d… Read More
  • Troubleshoot Network Manager, Apache, Wireless... in Linux Today's Blog is all about networking stuffs and I will be covering following points: Know your Network Controller Device with lspci Display all interfaces which are currently available, even if down with ifconfi… Read More
  • Tìm kiếm mã độc trên server hosting linux Những biểu hiện thường gặp server hosing đang chứa mã độc là thực hiện gửi spam mail, brute force ssh, DOS… tới server khác. Thông thường bạn sẽ nhận được cảnh báo này từ nhà cung câp dịch vụ server, vps… Sau đây là một số t… Read More
  • Rsync – Công cụ đồng bộ dữ liệu hiệu quả Rsync (Remote Sync) là một công cụ dùng để sao chép và đồng bộ file/thư mục được dùng rất phổ biến. Với sự trợ giúp của rsync, bạn có thể đồng bộ dữ liệu trên local hoặc giữa các server với nhau một cách … Read More
  • Cấu hình xoay vòng log file Cấu hình xoay vòng log file Phần lớn các bản phân phối sẽ cài đặt một cấu hình syslog mặc định cho hệ thống, bao gồm logging to messages và các log file khác trong thư mục /var/log. Để ngăn cản nhưng file này … Read More

0 comments:

Post a Comment