你好,游客 登录 注册 搜索
背景:
阅读新闻

LNAMP第二版(Nginx 1.2.0+Apache 2.4.2+PHP 5.4)

[日期:2012-05-09] 来源:Linux社区  作者:kerry [字体:大 中 小]
#每天定时切割Nginx日志
  1. cat >>/usr/local/nginx/sbin/cut_nginx_log.sh<< EOF 
  2. #!/bin/bash  
  3. # This script run at 00:00  
  4. # The Nginx logs path  
  5. logs_path_linuxidc="/data/logs/linuxidc/" 
  6. logs_path_linuxidc="/data/logs/king/" 
  7. mv ${logs_path_linuxidc}linuxidc_nginx.log ${logs_path_linuxidc}$linuxidc_nginx_$(date -d "yesterday" +"%Y%m%d").log  
  8. mv ${logs_path_king}king_nginx.log ${logs_path_king}king_nginx_$(date -d "yesterday" +"%Y%m%d").log  
  9. kill -USR1 `cat /usr/local/nginx/nginx.pid`  
  10. EOF  

chmod +x /usr/local/nginx/sbin/cut_nginx_log.sh
#添加计划任务,每天凌晨00:00切割nginx访问日志
crontab -e
00 00 * * * /bin/bash  /usr/local/nginx/sbin/cut_nginx_log.sh

#为apache安装rpaf模块,该模块用于apache做后端时获取访客真实的IP
#使用apxs安装模块.这里要使用此前apache编译安装后的apxs
cd /opt
tar -zxf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
/usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

#错误提示:
mod_rpaf-2.0.c: In function 'rpaf_cleanup':
mod_rpaf-2.0.c:150: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:151: error: 'conn_rec' has no member named 'remote_addr'
mod_rpaf-2.0.c:151: warning: implicit declaration of function 'inet_addr'
mod_rpaf-2.0.c:151: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c: In function 'change_remote_ip':
mod_rpaf-2.0.c:164: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:183: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:186: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:187: error: 'conn_rec' has no member named 'remote_addr'
mod_rpaf-2.0.c:187: error: 'conn_rec' has no member named 'remote_ip'
apxs:Error: Command failed with rc=65536

#解决办法:
#http://httpd.apache.org/docs/trunk/developer/new_api_2_4.html


#将150、151、164、183、186、187这几行的remote_ip修改成client_ip,remote_addr修改成client_addr

#编辑/usr/local/apache/conf/httpd.conf,添加模块参数,查找LoadModule php5_module modules/libphp5.so,在下方添加:

  1. LoadModule rpaf_module modules/mod_rpaf-2.0.so  
  2. #Mod_rpaf settings  
  3. RPAFenable On  
  4. #上面出现的192.168.9.9请修改为你本机所监听web服务的ip.多个IP用空格空开  
  5. RPAFproxy_ips 127.0.0.1 192.168.9.9  
  6. RPAFsethostname On  
  7. RPAFheader X-Forwarded-For 
linux
相关资讯       LNAMP 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款