简体   繁体   English

Django Python Project的Apache和mod_wsgi设置

[英]Apache & mod_wsgi settings for Django Python Project

I am trying to setup my django-python project on Google Compute Engine Debian8 VM. 我正在尝试在Google Compute Engine Debian8 VM上设置django-python项目。 I made few config changes in /etc/apache2/sites-available/000-default.conf & /etc/apache2/sites-available/default-ssl.conf files Then tried to restart the server. 我在/etc/apache2/sites-available/000-default.conf & /etc/apache2/sites-available/default-ssl.conf文件中进行了一些配置更改,然后尝试重新启动服务器。 And I got following Errors. 我得到了以下错误。 Uninstalling & reinstalling the apache2 too is not fixing this error. 卸载和重新安装apache2也不能解决此错误。 Any suggestions to fix this issue ? 有解决此问题的建议吗?

Command: 命令:

sudo service apache2 restart

Error: 错误:

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

Command: 命令:

sudo systemctl status apache2.service -l

Error: 错误:

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.

Thanks, 谢谢,

Have you read the error ? 你读错了吗? It's clearly stated why it fails: 明确说明了失败的原因:

Cannot load /usr/lib/apache2/modules/mod_wsgi.so into server: /usr/lib/apache2/modules/mod_wsgi.so: cannot open shared object file: No such file or directory 无法将/usr/lib/apache2/modules/mod_wsgi.so加载到服务器中:/usr/lib/apache2/modules/mod_wsgi.so:无法打开共享对象文件: 无此类文件或目录

do you have libapache2-mod-wsgi or libapache2-mod-wsgi-python3 installed? 您是否安装了libapache2-mod-wsgilibapache2-mod-wsgi-python3 if you have access to shell you can install it with 如果您有权使用Shell,则可以使用

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

Ran the Command to see the process running on port 80: 运行命令以查看端口80上运行的进程:

sudo netstat -ltnp | grep ':80'

Output: 输出:

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

Running the next two commands then fixed the issue: 运行以下两个命令,然后解决了该问题:

sudo kill -9 24482
sudo service apache2 restart

Hope it can be helpful. 希望对您有所帮助。

Thanks, 谢谢,

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

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