Bang hộiTiền mặt: 0 Xu Trò chơiHộp quà giáng sinhThứ Ba, 12:48:32 - 05/11/2024
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: Mod, SMod, Admin

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

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

#1 » Gửi bài gửi bởi nghiammo1992 » 29/01/2014 13:43 » @285912

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.
nghiammo1992 ✅
Hình đại diện của thành viên
Rank: ☀️2/30☀️
Cấp độ:
Tu luyện:
Like:
Online:
Bang hội: Tiếu Ngạo
Xếp hạng Bang hội: ⚡5/46⚡
Level:
Chủ đề đã tạo: 🩸4142/4142🩸
Tiền mặt:
Ngân hàng:
Nhóm:
Danh hiệu: ⚝⚝⚝Truyền Thuyết⚝⚝⚝
Giới tính:
Ngày tham gia:
Đến từ:
Thiết bị:
Số điện thoại:
(Firefox 26.0)


Quay về VPS - Server

 


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