如何在端口80上运行python瓶子?

2024-10-01 09:23:27 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试在端口80上运行python bottle时,我得到以下结果:

socket.error: [Errno 10013] An attempt was made to access a socket in a way forb
idden by its access permissions

我的目标是在端口80上运行web服务器,这样url就可以很好地整洁,而不需要指定端口 例如:

^{pr2}$

而不是

http://localhost:8080/doSomething

有什么想法吗?在

谢谢


Tags: to端口inanbottleaccesserrorsocket
2条回答

正如错误所说。你需要有在第80个端口上运行的权限,普通用户不能这样做。只要你的应用程序是免费的,你就可以使用它。在

但是考虑到安全性(和稳定性),您应该考虑不同的部署方式,例如nginx和gunicorn。在

  • 检查系统的防火墙设置。

  • 使用以下命令检查另一个应用程序是否已使用端口80:

    • 在unix上:netstat -an | grep :80
    • 在Windows上:netstat -an | findstr :80

根据Windows Sockets Error Codes

WSAEACCES 10013

Permission denied.

An attempt was made to access a socket in a way forbidden by its access permissions. An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO_BROADCAST). Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address with exclusive access. Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO_EXCLUSIVEADDRUSE option.

相关问题 更多 >