我正在尝试使用Amazon的ec2实例上的mod_wsgi在Apache上设置Django。我正在关注this指南进行设置。但在修改httpd.conf文件并使用configtest检查后,
/etc/init.d/httpd configtest
我收到以下错误:
'Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the server configuration' error.
以下是我的httpd.conf文件中的行
WSGIScriptAlias / /home/ec2-user/frontend/backend-django/backend/wsgi.py
WSGIPythonHome /home/ec2-user/frontend/frontendenv
WSGIPythonPath /home/ec2-user/frontend/backend-django
WSGIDaemonProcess frontend python-home=/home/ec2-user/frontend/frontendenv python-path=/home/ec2-user/frontend/backend-django
WSGIProcessGroup frontend
<Directory /home/ec2-user/frontend/backend-django/backend>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
当我抬头看SO时,我了解到我必须enable wsgi mod in apache或 load the module in httpd.conf。
但我得到了
No package a2enmod available
和
httpd: Syntax error on line 159 of /etc/httpd/conf/httpd.conf: Cannot load modules/mod_wsgi.so into server: /etc/httpd/modules/mod_wsgi.so: cannot open shared object file: No such file or directory
分别是错误。亚马逊的ec2实例正在亚马逊Linux 上运行。