[Hướng dẫn] Fix lỗi không khởi động được Apache

Chia sẻ kiến thức sử dụng VPS (máy chủ ảo) - Server (máy chủ riêng)

Các điều hành viên: Admin, Mod, SMod

[Hướng dẫn] Fix lỗi không khởi động được Apache

Gửi bàigửi bởi nghiammo1992 » 29/01/2014 13:43

This is a post for those sysadmins out there who run into problems running servers with a LAMP setup.

Occasionally, for some reason or another – usually because you changed some setting – it is necessary to restart apache from the terminal (i.e. in PuTTy).

Sometimes, though this is rare, this fails. If apache fails to restart and displays a message similar to “Address already in use: make_sock: could not bind to address” then you may be wondering how to get your server back online!

The precise message you receive could look something like this:

Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

You may or may not have other error messages, but let’s deal with this one!

The slow fix is to do a full hardware reboot of your server. This takes quite some time, and is not necessarily the best course of action, but it should solve this issue.

The reason for the message, however, is that there are still active connections which were not closed before. Probably some process was running when you hit “restart” (you should identify just what by checking – but that’s beyond the scope of what we’re doing here!). In any case, you’ll want to find out what process is running, and “kill” it.

Here’s how:

1) Type:

ps -aux |grep httpd

2) This will return a set of processes which are currently running. There should not be more than one or two. It will look something like this:

root 23605 0.1 0.1 861052 21208 ? Ss 10:07 0:00 /usr/sbin/httpd
apache 23609 0.0 0.0 220500 7720 ? S 10:07 0:00 /usr/sbin/httpd
root 23697 0.0 0.0 61184 776 pts/0 S+ 10:10 0:00 grep httpd

3) Kill the apache processes which are showing by typing:

kill -9 23609

Remember to replace “23609″ with whatever number your process actually is!

An alternative to this, if you have a lot of processes all running, is to use the “killall” method, which is:

killall -9 httpd

Then restart apache – it should work correctly!

service httpd restart

You’ll then want to set about identifying which processes were causing this in the first place!

Leave a comment below if this worked for you – or if it didn’t – and we might be able to help.
Hình đại diện của thành viên
nghiammo1992
☀️2/30☀️
☀️2/30☀️
 
Bài viết: 15
Ngày tham gia: 08/03/2012 10:56
Đến từ: Hà Giang
Thiết bị: Nokia N96
Số điện thoại: 0367790762

Quay về VPS - Server

 


  • Chủ đề tương tự
    Trả lời
    Xem
    Bài viết mới nhất

Ai đang trực tuyến?

Đang xem chuyên mục này: Không có thành viên nào đang trực tuyến6 khách