Apache mod_wsgi 指令未被使用

发布于 2024-09-16 05:35:54 字数 1898 浏览 5 评论 0原文

我有一台运行 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-default-backup

<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>

mine

<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)。

预计到达时间:我希望我的网站在子目录(即 foo.com/project)上运行。 (我无法轻松创建新的子域。)因此,本质上我希望将 *:80 的 VirtualHost 指令拆分为多个文件。这可能吗?

I have a server running Ubuntu Lucid 10.04.1 LTS server edition, which I want to deploy a Django app on using Apache + mod_wsgi. At the moment Apache does a directory index instead of using my WSGIScriptAlias command.

Any tips why would be appreciated. I installed mod_wsgi via aptitude and assume the "module configuration" below loads it.

/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/

in sites-enabled there are two files, 000-default-backup and mine.

000-default-backup

<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>

mine

<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>

Looking at the error log, there is no error. So I presume something in the 000-default-backup or apach2.conf is saying "serve this up as a directory" and the WSGI commands are never getting a chance to run. The paths are all correct.

Apache has Server version: Apache/2.2.14 (Ubuntu).

ETA: I want my site to run on a subdirectory, i.e. foo.com/project. (I can't easily create a new subdomain.) So essentially I want the VirtualHost instructions for *:80 to be split over multiple files. Is that possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

人间不值得 2024-09-23 05:35:54

好的,我成功了。

/etc/apache2/apache2.conf

之前更改

Include /etc/apache2/sites-enabled/

Include /etc/apache2/sites-enabled/000-default-backup

000-default-backup

在“”行

添加

Include sites-enabled/*.conf

myfile

只需删除“”和“”行即可。

OK I got it working.

/etc/apache2/apache2.conf

change

Include /etc/apache2/sites-enabled/

to

Include /etc/apache2/sites-enabled/000-default-backup

000-default-backup

at the bottom before the "</VirtualHost>" line

add

Include sites-enabled/*.conf

myfile

just remove the "<VirtualHost>" and "</VirtualHost>" lines.

装纯掩盖桑 2024-09-23 05:35:54

两个 VirtualHost 中都没有 ServerName,因此 Apache 将不知道如何区分它们,而只会按顺序使用第一个 VirtualHost。请查看 Apache 文档,了解正确设置 VirtualHost 所需的指令。

You don't have ServerName in either VirtualHost and so Apache will not know how to distinguish them and will just use the first VirtualHost in order. Go check the Apache documentation on required directives to be used to setup a VirtualHost properly.

淡墨 2024-09-23 05:35:54

如果您通过 aptitude 安装,您可能还想检查是否有 mod_wsgi的最新版本

If you installed via aptitude, you might also want to check if you have the latest version of mod_wsgi.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文