我正在尝试使用apache部署mod_wsgi来运行django应用程序,但出现错误:500个内部服务器错误。
这是apache日志显示的内容:
[Sun Dec 30 12:46:44.179450 2018] [mpm_event:notice] [pid 21350:tid 139933131320256] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun Dec 30 12:46:44.179649 2018] [core:notice] [pid 21350:tid 139933131320256] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 30 12:46:45.681614 2018] [wsgi:error] [pid 21353:tid 139933017503488] [remote 109.8.128.207:52109] mod_wsgi (pid=21353): Target WSGI script '/home/betourne/tonnerrekalaraclub/tonnerrekalaraclub/wsgi.py' cannot be loaded as Py$[Sun Dec 30 12:46:45.687031 2018] [wsgi:error] [pid 21353:tid 139933017503488] [remote 109.8.128.207:52109] mod_wsgi (pid=21353): Exception occurred processing WSGI script '/home/betourne/tonnerrekalaraclub/tonnerrekalaraclub/wsgi.py'.
这是我的虚拟主机conf:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/betourne/tonnerrekalaraclub/static
<Directory /home/betourne/tonnerrekalaraclub/static>
Require all granted
</Directory>
Alias /media /home/betourne/tonnerrekalaraclub/media
<Directory /home/betourne/tonnerrekalaraclub/media>
Require all granted
</Directory>
WSGIScriptAlias / /home/betourne/tonnerrekalaraclub/tonnerrekalaraclub/wsgi.py
WSGIDaemonProcess django_app python-path=/home/betourne/tonnerrekalaraclub python-home=/home/betourne/tonnerrekalaraclub/venv
WSGIProcessGroup django_app
<Directory /home/betourne/tonnerrekalaraclub/tonnerrekalaraclub>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
我不确定还有什么尝试,考虑了论坛中的每个主题,我一直在寻找解决方案已有2天了。
WWW-DATA拥有访问目录的所有权限,我检查了是否存在拼写错误...
我正在使用Ubuntu 18.04.1