Permission denied: make_sock: could not bind to address [::]:80

本文解释了Apache2在Linux环境下尝试使用80端口时遇到的权限拒绝错误,并提供了两种解决方案:一是使用sudo命令以root权限运行Apache2;二是更改默认监听端口至1024以上。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Some words about the errors you get which hopefully will save you from similar situations in future.

In Linux ports from 0 to 1024 are reserved for system use. This means that in order to use one, you must have the authority to change - access basic system settings. The root user has such privileges and can actually use a port from the range 0 - 1024.

In your problem as you can see, the system through Apache2 response indicates the root of the problem ([...]could not bind to address blah blah 80):

(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80

When the Apache2 http daemon starts, it tries to bind the 80 port as it is the default port for use in HTTP see, which is a port within the system assigned ports and as such it can only be accessed by root.

You executed the start command as a typical user without root privileges and led to failure to do so.

In simple words:

You:

Hi Apache2 i am Kongthap and i am telling you to start (/etc/init.d/apache2 start)

Apache2:

Ok i am starting (Starting web server apache2)

System please give me port 80 to use and listen for connections

System:

OK one moment to check

ahh sorry Apache2 but i cannot let you run at 80 port, it is for personal use

and you do not have the correct privileges to bind it.(Operation not permitted)

Apache2:

Ohh, Kongthap i failed to start, the system did not let me do it ((13)Permission denied:[...])

Conclusion

There are mainly two solutions to this problem:

1) Run the Apache2 http daemon with root privileges using sudo:

sudo service apache2 start prefered method or sudo /etc/init.d/apache2 start

2) Change the default port from 80 to something greater than 1024, say 200025009000, etc. A typical port to run when in such situation is 8080

sudo vi /etc/apache2/ports.conf

look for or if not there add:

Listen 8080

or any other port of your choice such as port > 1024 and the selected port is not used by another process.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值