我正在尝试在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.
谢谢,
答案 0 :(得分:0)
您是否阅读过该错误?它清楚地说明了它失败的原因:
无法将/usr/lib/apache2/modules/mod_wsgi.so加载到服务器:/usr/lib/apache2/modules/mod_wsgi.so:无法打开共享对象文件:没有此类文件或目录
您安装了libapache2-mod-wsgi
或libapache2-mod-wsgi-python3
吗?如果您有权访问shell,可以使用
sudo apt-get install libapache2-mod-wsgi
# or for python 3
sudo apt-get install libapache2-mod-wsgi-python3
答案 1 :(得分:0)
执行命令以查看在端口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
希望它有所帮助。
谢谢,