首页 > linux > Apache2.4编译mod_wsgi的问题

Apache2.4编译mod_wsgi的问题

昨天把apache升级到了2.4,配置完之后,就叫用我VPS的另一个WS男把他的python配置回去。今天他跟我说配置不了,叫我帮忙看一下,我囧。。。

我开始不知道那是啥,想着就是下载源码编译成一个.so库嘛,就做起来了。

#cd mod_wsgi-3.3

#./configure –with-apxs=/usr/local/apache/bin/apxs –with-python=/usr/bin/python
#make & make install
 

谁知到make的时候就出错了,大致的错误如下:

 
mod_wsgi.c: In function ‘wsgi_process_socket’:
mod_wsgi.c:10095:37: error: ‘conn_rec’ has no member named ‘remote_addr’
mod_wsgi.c:10103:27: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_wsgi.c:10103:41: error: ‘conn_rec’ has no member named ‘remote_addr’
mod_wsgi.c: In function ‘wsgi_hook_daemon_handler’:
mod_wsgi.c:12742:18: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_wsgi.c: In function ‘Auth_environ’:
mod_wsgi.c:13262:10: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_wsgi.c:13263:18: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_wsgi.c:13295:14: error: ‘conn_rec’ has no member named ‘remote_addr’
mod_wsgi.c: In function ‘wsgi_hook_access_checker’:
mod_wsgi.c:14395:29: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_wsgi.c: At top level:
mod_wsgi.c:14697:5: warning: initialization from incompatible pointer type [enabled by default]
mod_wsgi.c:14697:5: warning: (near initialization for ‘wsgi_authz_provider.check_authorization’) [enabled by default]
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

 

google了很久都没发现有解决方法,后来查了一下apache2.4更新的内容,发现没有了remote_ip和remote_addr这两个东西,看apache官网的原文:(点击这里直达

conn_rec->remote_ip and conn_rec->remote_addrThese fields have been renamed in order to distinguish between the client IP address of the connection and the useragent IP address of the request (potentially overridden by a load balancer or proxy). References to either of these fields must be updated with one of the following options, as appropriate for the module:
  • When you require the IP address of the user agent, which might be connected directly to the server, or might optionally be separated from the server by a transparent load balancer or proxy, use request_rec->useragent_ip and request_rec->useragent_addr.
  • When you require the IP address of the client that is connected directly to the server, which might be the useragent or might be the load balancer or proxy itself, use conn_rec->client_ip and conn_rec->client_addr.

 

于是就想着能不能把mod_wsgi.c文件自己改一下,把所有的remote_ip和remote_addr分别替换成client_ip和client_addr呢?好吧,最后改了,一make,成功了,make install也没问题,生成的.so库已经拷贝到apache的modules目录下了,后续就等他自己去搞吧,应该没问题的了,于是在这里mark一下,希望后来者可以参考一下吧~

 

突然发现上传不了图片,蛋疼。。。

分类: linux 标签: , , ,