繁体   English   中英

Django Python Project的Apache和mod_wsgi设置

[英]Apache & mod_wsgi settings for Django Python Project

我正在尝试在Google Compute Engine Debian8 VM上设置django-python项目。 我在/etc/apache2/sites-available/000-default.conf & /etc/apache2/sites-available/default-ssl.conf文件中进行了一些配置更改,然后尝试重新启动服务器。 我得到了以下错误。 卸载和重新安装apache2也不能解决此错误。 有解决此问题的建议吗?

命令:

sudo service apache2 restart

错误:

Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.

命令:

sudo systemctl status apache2.service -l

错误:

apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: active (exited) since Wed 2016-08-31 05:08:43 UTC; 3min 37s ago
  Process: 3539 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 3521 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE)
  Process: 3546 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Unit apache2.service entered failed state.
Starting LSB: Apache2 web server...
Starting web server: apache2(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
.
Started LSB: Apache2 web server.

谢谢,

你读错了吗? 明确说明了失败的原因:

无法将/usr/lib/apache2/modules/mod_wsgi.so加载到服务器中:/usr/lib/apache2/modules/mod_wsgi.so:无法打开共享对象文件: 无此类文件或目录

您是否安装了libapache2-mod-wsgilibapache2-mod-wsgi-python3 如果您有权使用Shell,则可以使用

sudo apt-get install libapache2-mod-wsgi
# or for python 3
sudo apt-get install libapache2-mod-wsgi-python3

运行命令以查看端口80上运行的进程:

sudo netstat -ltnp | grep ':80'

输出:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      24482/nginx -g daem
tcp6       0      0 :::80                   :::*                    LISTEN      24482/nginx -g daem

运行以下两个命令,然后解决了该问题:

sudo kill -9 24482
sudo service apache2 restart

希望对您有所帮助。

谢谢,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM