寻觅生命中的那一片浅草......

每月存档 六月, 2009

PHP-FPM高负载技巧 (PHP-FPM on highload tips)

When you running a highload website with PHP-FPM via FastCGI, the following tips may be useful to you : )
如果您高负载网站使用PHP-FPM管理FastCGI,这些技巧也许对您有用:)

1. Compile PHP’s modules as less as possible, the simple the best (fast);
1.尽量少安装PHP模块,最简单是最好(快)的

2. Increas PHP FastCGI child number to 100 and even more. Sometime, 200 is OK! ( On 4GB memory server);
2.把您的PHP FastCGI子进程数调到100或以上,在4G内存的服务器上200就可以
注:我的1g测试机,开64个是最好的,建议使用压力测试获取最佳值

3. Using SOCKET PHP FastCGI, and put into /dev/shm on Linux;
3.使用socket连接FastCGI,linux操作系统可以放在 /dev/shm中
注:在php-fpm.cnf里设置
<value name=”listen_address”>/tmp/nginx.socket</value>就可以通过socket连接FastCGI了,/dev/shm是内存文件系统,放在内存中肯定会快了

4. Increase Linux “max open files”, using the following command (must be root):
# echo ‘ulimit -HSn 65536′ >> /etc/profile
# echo ‘ulimit -HSn 65536 >> /etc/rc.local
# source /etc/profile
4.调高linux内核打开文件数量,可以使用这些命令(必须是root帐号)
echo ‘ulimit -HSn 65536’ >> /etc/profile
echo ‘ulimit -HSn 65536’ >> /etc/rc.local
source /etc/profile
注:我是修改/etc/rc.local,加入ulimit -SHn 51200的

5. Increase PHP-FPM open file description rlimit:
# vi /path/to/php-fpm.conf
Find “<value name=”rlimit_files”>1024</value>”
Change 1024 to 4096 or higher number.
Restart PHP-FPM.
5. 增加 PHP-FPM 打开文件描述符的限制:
# vi /path/to/php-fpm.conf
找到“<value name=”rlimit_files”>1024</value>”
把1024 更改为 4096 或者更高.
重启 PHP-FPM.

6. Using PHP code accelerator, e.g eAccelerator, XCache. And set “cache_dir” to /dev/shm on Linux.
6.使用php代码加速器,例如 eAccelerator, XCache.在linux平台上可以把`cache_dir`指向 /dev/shm

来源:http://groups.google.com/group/highload-php-en/browse_thread/thread/e48a9fce7ee116ab/db412d43c1c3f36a

转载自:http://willko.javaeye.com/blog/333270

CentOS5.2安装后的一些初始化操作

1、建立一个普通权限的用户
因为root用户对系统具有全权的操作权限,为了避免一些失误的操作,建议在一般情况下,以一般用户登录系统,必要的时候需要root操作权限时,再通过“su -”命令来登录为root用户进行操作。


useradd pysche
passwd pysche
usermod -G wheel pysche

修改pam配置,使非wheel组用户不能使用su命令登录为root:
vi /etc/pam.d/su

找到
#auth required /lib/security/$ISA/pam_wheel.so use_uid

将行首的 # 去掉。

然后
vi /etc/login.defs

在文件末尾加上

SU_WHEEL_ONLY yes

2、安装yum加速工具,并更新系统

yum install yum-fastestmirror -y
yum upgrade -y

3、安装mlocate工具

yum install mlocate -y

4、root邮件的修改
在系统出现错误或有重要通知发送邮件给root的时候,让系统自动转送到我们通常使用的邮箱中,这样方便查阅相关报告和日志。
vi /etc/aliases

在文件末尾加上
root: pysche@ipbfans.org

5、locate命令设置

vi /etc/updatedb.conf

在末尾增加
DAILY_UPDATE=yes

然后运行
updatedb

6、关闭不必要的服务

比如cups

/etc/init.d/cups stop
chkconfig cups off

除了以下服务以外,其他服务默认的都可以采用刚才的方法关闭:

atd
crond
irqbalance
lvm2-monitor
microcode_ctl
network
sendmail
sshd
syslog

7、停止ipv6

vi /etc/modprobe.conf

在文件末尾加上
alias net-pf-10 off
alias ipv6 off

8、关闭SELinux

vi /etc/selinux/config

改为
SELINUX=disabled

安装sudo工具

yum install sudo -y

安装好了以后,修改sudo的配置

vi /etc/sudousers


# %wheel ALL=(ALL) NOPASSWORD:ALL
去掉前面的 # , 然后保存文件。
这样修改了以后,只有所有属于wheel组的用户能执行sudo命令,并且执行sudo命令时只需要输入自己的密码即可。

10、修改SSH配置

vi /etc/ssh/sshd_config

增加ServerKey的强度
找到

#ServerKeyBits 768

改为

ServerKeyBits 1024

不允许root用户直接登录

#PermitRootLogin Yes

改为

PermitRootLogin no

禁止空密码登录

#PermitEmptyPasswords no

去掉前面的 #

全部修改完了以后,重启服务器

转载自:http://blog.qqpsp.com/?p=31

Debian下改IP

下载的是debian-500-i386-netinst.iso,安装好后,默认可以root登录,尝试过用普通用户登录,但输入sudo时说没有这个命令,先用root登录吧
IP是DHCP得到的,不方便,想改为静态的

改IP

# vi /etc/network/interfaces
将iface eth0 inet dhcp
修改为:
iface eth0 inet static
address 192.168.0.13
netmask 255.255.255.0
gateway 192.168.0.159

auto eth0

保存退出

重启网络
# /etc/init.d/networking restart

参考文章:http://blog.chinaunix.net/u1/50685/showart_427694.html

spine的configure: error: Cannot find MySQL headers

有朋友在ubuntu上安装Cacti的spine,configure时,提示
configure: error: Cannot find MySQL headers.  Use –with-mysql= to specify non-default path.

记得上次在CentOS上安装也出现过这个错误,yum -y install mysql-devel就可以了

然后告诉朋友,要他安装mysql-devel,结果输入sudo apt-get install mysql-devel

提示发现没有这个包

Google了下

发现在ubuntu上应该安装libmysqlclient15-dev

sudo apt-get install libmysqlclient15-dev

postfix权威指南笔记

pcre perl兼容正则表达式

postconf -m 查看postfix支持的函数

postmap -q 测试任何种类的查询表

postmap -q hash:/etc/postfix/transport
postmap -q mysql:/etc/postfix/transport.cf

postalias

postfix check
检查配置文件是否有问题,文件与目录的拥有权是否正确,甚至帮你创建任何遗失的目录,

postfix的等效机制是定义在main.cf的queue_run_delay参数,默认值是1000秒

postfix -D 得出调试信息

/etc/services —查看下文件内容

postsuper -h 保留邮件队列

postsuper -H 将保留的邮件队列重新激活

postsuper -r ALL 将被延迟了的邮件重新排队

postcat -q 邮件ID 查看一个队列文件的内容

要求postfix立刻投递滞留在队列里的邮件的操作成为清空(flush),
命令是 postqueue -f

postqueue -s 清空寄到特定站点的邮件

postconf -l 查看postfix支持的锁机制

最简单的虚拟网域模式,是每位用户都可以收到每个网域的邮件。就用户的感受而言,
就好像同一个邮箱有多个地址一样。这种模式的设定方法最简单,只要将所有虚拟网域名称都列在mydestination参数,并像平常一样为每一位用户(不管他们在哪一个网域)都创建自己的系统账户,他们就可以收到写给任何网域的邮件。

默认情况下,flush只管理relay_domains所列的网域。如果还有其他网域也需要快速清空服务,你可以将它们的网域名称列在fast_flush_domains

2009年六月
« 5月   7月 »
1234567
891011121314
15161718192021
22232425262728
2930