弹性豆茎上的mod_cloudflare

时间:2015-02-03 15:06:44

标签: apache amazon-web-services elastic-beanstalk httpd.conf cloudflare

我尝试通过提供如下配置文件来安装它:

packages:
  rpm:
    mod_cloudflare: https://www.cloudflare.com/static/misc/mod_cloudflare/centos/mod_cloudflare-el6-x86_64.latest.rpm

files:
  "/etc/httpd/conf.d/cloudflare.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
      CloudFlareRemoteIPHeader X-Forwarded-For
      CloudFlareRemoteIPTrustedProxy 10.0.0.0/8

但最终没有正确安装:

AH00526: Syntax error on line 2 of /etc/httpd/conf.d/cloudflare.conf:
Invalid command 'CloudFlareRemoteIPHeader', perhaps misspelled or defined by a module not included in the server configuration

我发现cloudflare.so上没有load_module所以在将加载模块手动添加到cloudflare.conf后我得到了这个:

httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/cloudflare.conf: Cannot load modules/mod_cloudflare.so into server: /etc/httpd/modules/mod_cloudflare.so: undefined symbol: ap_log_rerror

我找不到解决方案......

1 个答案:

答案 0 :(得分:3)

修复它:

packages:
  yum:
      glibc.i686: []
      libtool: []
      httpd24-devel: [] // <--!

commands:
  00-cloudflare: 
    command: wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
    cwd: /tmp
  01-cloudflare: 
    command: apxs -a -i -c mod_cloudflare.c
    cwd: /tmp

files:
  "/etc/httpd/conf.d/cloudflare.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
      CloudFlareRemoteIPHeader X-Forwarded-For
      CloudFlareRemoteIPTrustedProxy 10.0.0.0/8