apache2.4部署django启动报错(初学者)

部署环境是: ubuntu16.04, apache2.4.18,django1.9.8

配置文件/etc/apache2/apache2.conf的全部内容

# 项目位置/home/balabala/Documents/mysite
WSGIScriptAlias / /home/balabala/Documents/mysite/mysite/wsgi.py
WSGIPythonPath /home/balabala/Documents/mysite
<Directory /home/balabala/Documents/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

报错信息

$ systemctl start apache2.service
Job for apache2.service failed because the control process exited with error code. 
See "systemctl status apache2.service" and "journalctl -xe" for details.


$ systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since 一 2016-09-19 14:23:24 CST; 35s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 7106 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

9月 19 14:23:24 yue apache2[7106]:  *
9月 19 14:23:24 yue apache2[7106]:  * The apache2 configtest failed.
9月 19 14:23:24 yue apache2[7106]: Output of config test was:
9月 19 14:23:24 yue apache2[7106]: AH00534: apache2: Configuration error: No MPM loaded.
9月 19 14:23:24 yue apache2[7106]: Action 'configtest' failed.
9月 19 14:23:24 yue apache2[7106]: The Apache error log may have more information.
9月 19 14:23:24 yue systemd[1]: apache2.service: Control process exited, code=exited status=1
9月 19 14:23:24 yue systemd[1]: Failed to start LSB: Apache2 web server.
9月 19 14:23:24 yue systemd[1]: apache2.service: Unit entered failed state.
9月 19 14:23:24 yue systemd[1]: apache2.service: Failed with result 'exit-code'.

问题描述

自己就是按照官方文档配置了第一步,然后systemctl start apache2就出现了上面的error,初学者拜托各位指教。

阅读 5.9k
2 个回答

从下面这行错误,应该是没有加载wsgi模块:

9月 19 14:23:24 yue apache2[7106]: AH00534: apache2: Configuration
error: No MPM loaded.

如果用的是mod_wsgi,配置中需要加载它:

LoadModule wsgi_module modules/mod_wsgi.so

虽然是官方文档,但实际生产环境很少这么用的,一般用nginx和gunicorn(或uwsgi)

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题