分类 ‘Linux/Server’ 下的文章
伪装WEB服务器(apache/lighttpd/nginx)
通过命令:
?View Code BASH# curl -s -I www.codigg.com | fgrep ‘Server’
Server: Apache/2.0.52 (Red Hat)
ImageMagick在64位下编译遇到的问题
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol’ can not be used when
making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libgd.la] 错误 1
shell命令:使用curl操作ftp(上传、下载、删除等)
在shell中如果直接用ftp命令来操作服务器,太麻烦了,要交互。这里用curl来实现,本站提供的康盛漫游平台-超级大富翁的购买推荐页面 http://www.codigg.com/demo/rich/final.html 就是用这个实现的上传。
无需多说,直接上代码
?View Code BASH# 列出某目录下的所有文件
curl -u user:psw ftp://www.codigg.com
proxy server后的apache如何获取用户真实IP
本文代码在SuSE/Ubuntu下测试通过(包括32位和64位),如果看完本文解决不了你的问题,请用google搜素关键字:AddAcceptForwarder
用lighttpd做proxy server,来对多个apache做负载均衡已经是很常见的做法了。但是默认情况下,apache日志中获不到访问者的真实IP,对于分析日志带来一定困难,最简单的方法是使用mod_extract_forwarded2。
安装编译脚本如下(apxs2需要先安装apache2-devel):
?View Code BASHmkdir mod_extract_forwarded2
PHP5.1下启用json_encode方法
php5.2之后才将php-json作为标准扩展,一些Linux发行版上的php版本依然还是5.1.x,如SuSE10.1 , 导致使用json很不方便。网上也有一些文章介绍如何在SuSE10SP1下启用该扩展,如:
Enabling JSON on PHP 5.1.2 in SLES10
可惜这篇文章的方法现在已经不能用了。这里介绍一些解决方法
方法一:直接用php写json_encode和json_decode的函数,然后调用,这个网上已经有一些开源的代码了,如 Service JSON 方法比较简单,但是使用也不是那么得心应手。这里不再赘述。
方法二:安装扩展,需要先安装php5-devel,因为要使用phpize,脚本如下:

