我有一台运行Ubuntu Lucid 10.04.1 LTS服务器版本的服务器,我想使用Apache + mod_wsgi部署一个Django应用程序。目前Apache执行目录索引而不是使用我的WSGIScriptAlias命令。
任何提示为什么会受到赞赏。我通过aptitude安装了mod_wsgi,并假设下面的“模块配置”加载它。
/etc/apache2/apache2.conf中
#....
# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
# Include all the user configurations:
Include /etc/apache2/httpd.conf
# Include ports listing
Include /etc/apache2/ports.conf
#....
# Include generic snippets of statements
Include /etc/apache2/conf.d/
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
在启用网站的情况下,有两个文件,000-default-backup和我的。
000 - 缺省 - 备份
<VirtualHost *:80>
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
雷
<VirtualHost *:80>
WSGIDaemonProcess project-production user=me group=me threads=10 python-path=/home/me/virtualenvs/project/lib/python2.6/site-packages
WSGIScriptAlias /project /home/me/projects/project/releases/current/feedback/apache/feedback.wsgi
<Directory /home/me/projects/project/releases/current/project/apache>
WSGIProcessGroup project-production
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
查看错误日志,没有错误。所以我假设000-default-backup或者apach2.conf中的某些内容是“将其作为一个目录提供服务”,并且WSGI命令永远不会有机会运行。路径都是正确的。
Apache有服务器版本:Apache / 2.2.14(Ubuntu)。
ETA:我希望我的网站在子目录上运行,即foo.com/project。 (我无法轻松创建新的子域。)基本上我希望将*:80的VirtualHost指令拆分为多个文件。这可能吗?
答案 0 :(得分:1)
好的,我让它运转了。
<强> /etc/apache2/apache2.conf中强>
变化
Include /etc/apache2/sites-enabled/
到
Include /etc/apache2/sites-enabled/000-default-backup
<强> 000 - 缺省 - 备份强>
位于“</VirtualHost>
”行之前的底部
添加
Include sites-enabled/*.conf
<强> MYFILE 强>
只需删除“<VirtualHost>
”和“</VirtualHost>
”行。
答案 1 :(得分:0)
您在VirtualHost中没有ServerName,因此Apache不知道如何区分它们,并且只是按顺序使用第一个VirtualHost。请查看Apache文档,了解用于正确设置VirtualHost的必需指令。
答案 2 :(得分:-1)
如果您是通过aptitude安装的,那么您可能还想检查一下是否有latest version of mod_wsgi。