在64位Windows上将mod_wsgi模块加载到Apache中的问题

8 投票
3 回答
15187 浏览
提问于 2025-04-16 18:09

我正在尝试安装mod_wsgi模块,按照这个说明进行操作。我从这个网站下载了mod_wsgi.so文件。看起来在我把以下这一行添加到httpd.conf后,apache无法正常重启服务,页面也无法加载。

LoadModule wsgi_module modules/mod_wsgi.so

我检查了一些问题,具体如下:

  1. 文件名是正确的 - 是mod_wsgi.so,而不是mod_wsgi.so.so
  2. 文件的权限设置和其他正常加载的模块一样
  3. Python是为所有用户安装的

环境信息:

  • Windows Server® Standard FE 64位
  • 在WAMP 2.0上运行Apache 2.2.8
  • 为所有用户安装的Python 2.7.1

在没有加载这个模块的情况下,apache运行正常。我的问题出在哪里呢?

应用程序的error.log:

[Mon May 23 10:12:20 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Mon May 23 10:12:20 2011] [notice] Child 4528: Exit event signaled. Child process is ending.
[Mon May 23 10:12:21 2011] [notice] Child 4528: Released the start mutex
[Mon May 23 10:12:22 2011] [notice] Child 4528: All worker threads have exited.
[Mon May 23 10:12:27 2011] [notice] Child 4528: Child process is exiting
[Mon May 23 10:12:28 2011] [notice] Parent: Child process exited successfully.
[Mon May 23 10:13:46 2011] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Mon May 23 10:13:46 2011] [notice] Server built: Jan 18 2008 00:37:19
[Mon May 23 10:13:46 2011] [notice] Parent: Created child process 5316
[Mon May 23 10:13:46 2011] [notice] Child 5316: Child process is running
[Mon May 23 10:13:46 2011] [notice] Child 5316: Acquired the start mutex.
[Mon May 23 10:13:46 2011] [notice] Child 5316: Starting 64 worker threads.
[Mon May 23 10:13:46 2011] [notice] Child 5316: Starting thread to listen on port 81.
[Mon May 23 10:14:57 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Mon May 23 10:14:57 2011] [notice] Child 5316: Exit event signaled. Child process is ending.
[Mon May 23 10:14:58 2011] [notice] Child 5316: Released the start mutex
[Mon May 23 10:14:59 2011] [notice] Child 5316: All worker threads have exited.
[Mon May 23 10:15:04 2011] [notice] Child 5316: Child process is exiting
[Mon May 23 10:15:04 2011] [notice] Parent: Child process exited successfully.

从apache的error.log来看,安装的apache是32位的,这样理解对吗?

解决方案:把所有东西都换成64位的。

3 个回答

3

我在Windows 2008服务器上成功运行了Apache和Mod_wsgi。

彼得提供的64位Apache版本的链接坏了。我找到一个对我有效的链接在这里:

http://www.apachelounge.com/download/win64/

记得查看readme.txt文件,安装过程非常简单。

他提供的64位mod_wsgi的链接还是有效的:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi

我使用了win-amd64版本,运行得很好,我想我用的硬件是Intel的。

我确保Apache、Mod_wsgi和Python的版本都是匹配的。我用的mod_wsgi版本是3.3。

3

根据我的理解...

目前,微软Windows系统上没有官方的64位Apache和PHP版本。

不过,有个家伙在写这篇文章的时候,至少为我们编译了Apache 2.2.19 x64,你可以在这里下载。

如果你想要更新的版本,就得自己编译了,但这可不是一件简单的事!

而且,即使你成功在Windows上运行了Apache x64,你打算怎么处理mod_wsgi呢?这正是我决定创建一个Arch Linux的LAMP环境的原因。我现在已经可以正常使用了,但因为Aptana和Django项目不同步,我又在考虑Windows的解决方案。

如果你找到好的解决办法,请告诉我!

编辑:我找到了一些适用于py2.6和2.7的64位mod_wsgi,但我还没能让它们工作。

编辑:太好了!我成功了!我的Apache服务监控器现在显示绿色灯,显示的是Apache/2.2.19 (Win64) mod_wsgi/3.3 Python/2.6.4。我使用2.6.4版本是因为Autodesk Maya也在用这个版本,我想保持一致。

7

我也遇到过这种情况,Apache可以在64位的Windows上运行,但如果加载了mod_wsgi就不行了。

我找到了一种比较简单的解决办法:

  1. 下载并安装一个64位的Apache版本,去http://wampserver.com/下载和安装就很方便。
  2. 这个页面下载mod_wsgi。
  3. 把下载的压缩文件里的内容解压到c:\wamp\bin\apache\Apache2.2.21\modules\这个文件夹里。
  4. 编辑httpd.conf文件,添加一行:LoadModule wsgi_module modules/mod_wsgi.so
  5. 重启Apache,这样你就可以继续你的Django开发了。

总结:要在64位的Windows上运行Apache和mod_wsgi,两个都必须是64位的。

撰写回答