我有一台运行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指令拆分为多个文件 . 那可能吗?
3 回答
好的我搞定了 .
/etc/apache2/apache2.conf
更改
至
000-default-backup
在“
</VirtualHost>
”行之前的底部加
myfile
只需删除“
<VirtualHost>
" and "</VirtualHost>
”行 .您在VirtualHost中没有ServerName,因此Apache不知道如何区分它们,并且只是按顺序使用第一个VirtualHost . 请查看Apache文档,了解用于正确设置VirtualHost的必需指令 .
如果您通过aptitude安装,您可能还想检查是否有latest version of mod_wsgi .