Apache + WSGI: Address already in use: make_sock: could not bind to address

江枫思渺然 提交于 2019-12-25 18:42:17

问题


I get the following message when I try to start Apache2:

* Restarting web server apache2                                                  
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:2080
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

uwsgi is listening on that port:

sudo netstat -ltnp | grep ':2080'
tcp        0      0 0.0.0.0:2080            0.0.0.0:*               LISTEN  884/uwsgi

Before that I installed wsgi manually

sudo apt-get install libapache2-mod-wsgi

because I got this message when I tried to start Apache:

Syntax error on line 25 of /etc/apache2/sites-enabled/graphite:
Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!

Killing the process does not work because it gets automatically restarted. I can disable it with the command

sudo a2dismod wsgi

But then I get the "Invalid command 'WSGIDaemonProcess' message once again.

The apache error.log does not contain any information on that.

Any idea what could solve this? Because right now I'm kind of in a deadlock.


回答1:


If you get:

Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed.

then it means you haven't enabled the mod_wsgi module in Apache and so it isn't loaded.

That or you are running an ancient Apache 1.3 version, although that is highly unlikely as don't think you can even get mod_wsgi binary packages for such an old Apache version now.

As to port usage, you obviously can't have Apache and uWSGI using the same one, so you need to set them up with different ports.



来源:https://stackoverflow.com/questions/16915360/apache-wsgi-address-already-in-use-make-sock-could-not-bind-to-address

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!