作者:reistlin
发布时间:October 31, 2011
分类:自由点击

举例一:
[reistlin@reistlin.com ~]$ cat /proc/scsi/scsi | grep Model
Vendor: ATA Model: OCZ-VERTEX2 3.5 Rev: 1.27
Vendor: ATA Model: OCZ-VERTEX2 3.5 Rev: 1.27
通过 Google 查询:OCZ-VERTEX2 3.5寸 固态硬盘(Firmware:1.27)
[ http://www.google.com.hk/search?q=OCZ-VERTEX2+3.5 ]
举例二:
[reistlin@reistlin.com ~]$ cat /proc/scsi/scsi | grep Model
Vendor: Slimtype Model: DVD A DS8A5S Rev: WC22
Vendor: ATA Model: ST31000524NS Rev: SN11
Vendor: ATA Model: ST31000524NS Rev: SN11
Vendor: ATA Model: ST31000524NS Rev: SN11
通过 Google 查询:ST31000524NS 希捷 SATA 1TB 7200转 32M
[ http://www.google.com.hk/search?q=ST31000524NS ]
作者:reistlin
发布时间:September 7, 2011
分类:自由点击

Apache,Nginx 非 root 用户下启动 HTTP 80 端口(端口范围小于1024)
方法一:
所有用户都可以运行(因为是755权限,文件所有者:root,组所有者:root)
chown root:root nginx
chmod 755 nginx
chmod u+s nginx
方法二:
仅 root 用户和 reistlin 用户可以运行(因为是750权限,文件所有者:root,组所有者:reistlin)
chown root:reistlin nginx
chmod 750 nginx
chmod u+s nginx
作者:reistlin
发布时间:August 3, 2011
分类:自由点击

问题:
Info: Traffic rate for "eth0" higher than set maximum 100 Mbit (707->9722, r319 t12255), syncing.
解决:
vim /etc/vnstat.conf
# maximum bandwidth (Mbit) for all interfaces, 0 = disable feature
# (unless interface specific limit is given)
MaxBandwidth 1000
作者:reistlin
发布时间:May 10, 2011
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/322
更新时间: 2011.05
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要


一,环境:
Debian 6.0.1
Nginx 0.8.54 (nginx-0.8.54.tar.gz)
Openssl 0.9.8o (openssl-0.9.8o.tar.gz)
Pcre 8.12 (pcre-8.12.tar.gz)
Zlib 1.2.5 (zlib-1.2.5.tar.gz)
用户信息:
用户:www-data
组:www-data
主目录:/home/www-data
目录结构:
app:应用程序安装目录
pkgs:源代码包目录
pkgs/build:源代码包编译目录
阅读剩余部分...
作者:reistlin
发布时间:May 4, 2011
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/305
更新时间: 2011.05
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

phpMyAdmin 是一个以 PHP 为基础,以 Web-Base 方式架构在网站主机上的 MySQL 的数据库管理工具,让管理者可用 Web 接口管理 MySQL 数据库。
通过 Nginx auth_basic 验证功能,可以为 phpMyAdmin 目录增加用户名,密码验证机制。防止任意用户访问 phpMyAdmin(0day 我怕怕!)。

阅读剩余部分...
作者:reistlin
发布时间:May 3, 2011
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/302
更新时间: 2011.05
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

一,环境:
Debian 6.0.1
PHP 5.2.17 (php-5.2.17.tar.gz)
PHP-FPM 5.2.17 (php-5.2.17-fpm-0.5.14.diff.gz)
用户信息:
用户:www-data
组:www-data
主目录:/home/www-data
目录结构:
app:应用程序安装目录
pkgs:源代码包目录
pkgs/build:源代码包编译目录
阅读剩余部分...
作者:reistlin
发布时间:April 28, 2011
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/301
更新时间: 2011.04
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

配置 Nginx Http Proxy 代理服务器,与 [Squid] 功能一样,适用于正向代理 Http 网站。
一,Nginx 正向代理配置文件:
server {
resolver 8.8.8.8;
resolver_timeout 5s;
listen 0.0.0.0:8080;
access_log /home/reistlin/logs/proxy.access.log;
error_log /home/reistlin/logs/proxy.error.log;
location / {
proxy_pass $scheme://$host$request_uri;
proxy_set_header Host $http_host;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0;
proxy_connect_timeout 30;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
}
}二,Nginx 正向代理配置说明:
1,配置 DNS 解析 IP 地址,比如 Google Public DNS,以及超时时间(5秒)。
resolver 8.8.8.8;
resolver_timeout 5s;
2,配置正向代理参数,均是由 Nginx 变量组成。其中 proxy_set_header 部分的配置,是为了解决如果 URL 中带 "."(点)后 Nginx 503 错误。
proxy_pass $scheme://$host$request_uri;
proxy_set_header Host $http_host;
3,配置缓存大小,关闭磁盘缓存读写减少I/O,以及代理连接超时时间。
proxy_buffers 256 4k;
proxy_max_temp_file_size 0;
proxy_connect_timeout 30;
4,配置代理服务器 Http 状态缓存时间。
proxy_cache_valid 200 302 10m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
三,不支持代理 Https 网站
因为 Nginx 不支持 CONNECT,所以无法正向代理 Https 网站(网上银行,Gmail)。
如果访问 Https 网站,比如:https://www.google.com,Nginx access.log 日志如下:
"CONNECT www.google.com:443 HTTP/1.1" 400
作者:reistlin
发布时间:April 27, 2011
分类:自由点击

1,配置文件:/etc/ssh/sshd_config(拒绝用户 user1 user2 登陆;拒绝组 group1 group2 登陆)
vim /etc/ssh/sshd_config
DenyUsers user1 user2
DenyGroups group1 group2
2,重新启动 sshd 服务
/etc/init.d/sshd restart
作者:reistlin
发布时间:April 16, 2011
分类:自由点击

问题:
nginx error – 413 Request Entity Too Large
解决:
1,在 nginx.conf 配置文件中:client_max_body_size 8M;
vim /etc/nginx/sites-available/reistlin.com
server {
client_max_body_size 8M;
}2,重新启动 nginx 服务
/etc/init.d/nginx reload
作者:reistlin
发布时间:April 16, 2011
分类:自由点击

1. 编译:
./configure –prefix=/home/apache \
–enable-module=so \
–enable-module=rewrite \
–activate-module=src/modules/fastcgi/libfastcgi.a
2. 配置:
vi /home/apache/conf/httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog /home/apache/logs/rewrite_log
RewriteLogLevel 0
</IfModule>
3. 测试:
重新启动Apache
/etc/init.d/httpd restart
检查Apache静态编译模块
/home/apache/bin/httpd -l
作者:reistlin
发布时间:April 12, 2011
分类:自由点击

环境:
Debian 6 zlib-1.2.5 openssl-1.0.0d libssh2-1.2.8
问题:
错误信息:
collect2: ld returned 1 exit status
[scp_nonblock] Error 1
[all-recursive] Error 1
collect2: ld returned 1 exit status
make[2]: *** [scp_nonblock] Error 1
make[2]: Leaving directory `/home/www-data/pkgs/build/libssh2-1.2.8/example'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/www-data/pkgs/build/libssh2-1.2.8/example'
make: *** [all-recursive] Error 1
解决:
编译参数(+):LDFLAGS=-ldl
./configure --with-openssl --with-libssl-prefix=/usr/local/ssl/ LDFLAGS=-ldl
make clean
./configure --with-openssl --with-libssl-prefix=/usr/local/ssl/ LDFLAGS=-ldl
configure: summary of build options:
version: -
Host type: i686-pc-linux-gnu
Install prefix: /usr/local
Compiler: gcc
Compiler flags: -g -O2
Library types: Shared=yes, Static=yes
Crypto library: openssl: yes (AES-CTR: no) libgcrypt: no
Debug build: no
Path to sshd: /usr/sbin/sshd (only for self-tests)
libz compression: yes
make
make install
作者:reistlin
发布时间:April 7, 2011
分类:自由点击

环境:
Debian 6 zlib-1.2.5 libpng-1.4.4
zlib-1.2.5 安装路径:$HOME/lib/zlib-1.2.5
(ln -s $HOME/lib/zlib-1.2.5 $HOME/lib/zlib)
libpng-1.4.4 安装路径:$HOME/lib/libpng-1.4.4
(ln -s $HOME/lib/libpng-1.4.4 $HOME/lib/libpng)
问题:
checking for zlibVersion in -lz... no
configure: error: zlib not installed
分析:
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor解决:
export LDFLAGS="-L $HOME/lib/zlib/lib"
export CPPFLAGS="-I $HOME/lib/zlib/include"
./configure --prefix=$HOME/lib/libpng-1.4.4
make
make install
作者:reistlin
发布时间:March 24, 2011
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/199
更新时间: 2011.03
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

1,安装 nfs,portmap 服务:
rpm -ivh nfs-utils-1.0.9-42.el5.i386.rpm nfs-utils-lib-1.0.8-7.6.el5.i386.rpm system-config-nfs-1.3.23-1.el5.noarch.rpm portmap-4.0-65.2.2.1.i386.rpm
2,配置 nfs 目录,权限:/etc/exports
可以通过配置 nfs 目录权限来进行访问控制,包括来源,目录,读写权限。
reistlin:~# vim /etc/exports
/home/nfs/public *(ro)
/home/nfs/domain *.reistlin.com(ro,async)
/home/nfs/backup reistlin(rw,async)
配置说明:
所有用户可以访问 /home/nfs/public 目录(只读);
来自 *.reistlin.com 域的用户可以访问 /home/nfs/domain 目录(只读);
用户 reistlin 可以访问 /home/nfs/backup 目录(读写)。
建议通过映射 UID 和 GID 的方法来设置权限:
anonuid=xxx
将远程访问的所有用户都映射为匿名用户,并指定该用户为本地用户(UID=xxx)
anongid=xxx
将远程访问的所有用户组都映射为匿名用户组,并指定该匿名用户组为本地用户组(GID=xxx)
3,配置 nfs 协议端口:/etc/sysconfig/nfs
因为 rpc 服务,mount TCP/UDP 端口都是随机的,所以会导致默认配置的 nfs 服务器,通过防火墙时无法进行正常挂载,导致 mount 失败(随机端口无法配置防火墙访问策略)。
reistlin:~# vim /etc/sysconfig/nfs
RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
版本区别:
如果是 RHEL 5.x 版本,请直接修改 /etc/sysconfig/nfs 将里面的上述内容注释掉,重新启动NFS服务。
如果是 RHEL 4.x 版本,默认没有此文件,所以,请创建一个 nfs 配置文件放到 /etc/sysconfig 目录下。
4,启动 nfs 服务:nfs,portmap
reistlin:~# /etc/init.d/portmap start
Starting portmap: [ OK ]
reistlin:~# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
作者:reistlin
发布时间:March 8, 2011
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/176
更新时间: 2011.03
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

配置1:4 CPU (4 Core) + 4 worker_processes (每个worker_processes 使用1个CPU)
[reistlin@reistlin.com ~]$ cat /proc/cpuinfo | grep processor
processor : 0
processor : 1
processor : 2
processor : 3
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
配置2:8 CPU (8 Core) + 8 worker_processes (每个worker_processes 使用1个CPU)
[reistlin@reistlin.com ~]$ cat /proc/cpuinfo | grep processor
processor : 0
processor : 1
processor : 2
processor : 3
processor : 4
processor : 5
processor : 6
processor : 7
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
配置3:16 CPU (16 Core) + 16 worker_processes (每个worker_processes 使用1个CPU)
[reistlin@reistlin.com ~]$ cat /proc/cpuinfo | grep processor
processor : 0
processor : 1
processor : 2
processor : 3
processor : 4
processor : 5
processor : 6
processor : 7
processor : 8
processor : 9
processor : 10
processor : 11
processor : 12
processor : 13
processor : 14
processor : 15
worker_processes 16;
worker_cpu_affinity 0000000000000001 0000000000000010 0000000000000100 0000000000001000 0000000000010000 0000000000100000 0000000001000000 0000000010000000 0000000100000000 0000001000000000 0000010000000000 0000100000000000 0001000000000000 0010000000000000 0100000000000000 1000000000000000;
作者:reistlin
发布时间:February 14, 2011
分类:自由点击

1,使用 head 和 tail 命令:
命令行:
head -n <number> <filename> | tail -n 1
举例:
显示 test.txt 文件第 1 行内容:
head -n 1 test.txt | tail -n 1
显示 test.txt 文件第 2 行内容:
head -n 2 test.txt | tail -n 1
2,使用 sed 命令:
命令行:
sed -n <number>p <filename>
举例:
显示 test.txt 文件第 3 行内容:
sed -n 3p test.txt
显示 test.txt 文件第 4 行内容:
sed -n 4p test.txt
作者:reistlin
发布时间:February 11, 2011
分类:自由点击

问题:
sendmail 日志文件 /var/log/maillog 报错:
Feb 10 05:59:01 reistlin sendmail[2079]: My unqualified host name (reistlin) unknown; sleeping for retry
Feb 10 06:00:01 reistlin sendmail[2079]: unable to qualify my own domain name (reistlin) -- using short name
解决:
/etc/hosts 文件中,主机名需要增加 Fully Qualified Domain Name (FQDN)。
编辑 /etc/hosts 文件,增加一个 FQDN,比如:reistlin.localdomain(最后一行)
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.0.1 reistlin.localdomain reistlin
最后,重新启动 sendmail:
[root@reistlin ~]# /etc/init.d/sendmail restart
测试:
[root@reistlin ~]# sendmail -v
Recipient names must be specified
执行 sendmail -v 如果立即显示 Recipient names must be specified 即表示没有 FQDN 解析问题了。反之,如果无任何显示,则表示 sendmail 无法正确解析 FQDN,请求 sleeping 了。
作者:reistlin
发布时间:December 10, 2010
分类:自由点击

参考文章:http://blog.s135.com/post/288/(张宴)
官方网站:http://home.tiscali.cz/~cz210552/webbench.html
1,下载,解压缩
reistlin:~# wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
reistlin:~# tar zxvf webbench-1.5.tar.gz
reistlin:~# cd webbench-1.5
2,配置编译文件:Makefile 自定义安装路径
reistlin:~# vim Makefile
# 自定义安装路径,默认安装路径:/usr/local/
PREFIX?= /home/reistlin/webbench
阅读剩余部分...
作者:reistlin
发布时间:December 3, 2010
分类:自由点击

1,说明:
/etc/security/limits.conf 是 Linux PAM(插入式认证模块,Pluggable Authentication Modules)中 /lib/security/pam_limits.so 的配置文件。
2,举例:
限制用户:reistlin 最大登录数量为:1,适用于:系统本地,SSH远程登录。
reistlin:~# vim /etc/security/limits.conf
reistlin - maxlogins 1
当用户 reistlin 通过系统本地或者SSH登录后,如果重复登录系统会拒绝,提示:
Too many logins for 'reistlin'.
Last login: Fri Dec 3 00:00:01 2010 from 192.168.0.1
作者:reistlin
发布时间:December 2, 2010
分类:原创文章
作者: reistlin
来源: http://www.reistlin.com/blog/79
更新时间: 2010.12
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要


[步骤一] 服务器端配置:Redhat Enterprise Linux AS(RHEL)
1,检查 syslogd 系统进程,默认是启动状态,默认参数为:-m 0
reistlin:~# ps aux | grep syslogd
root 2619 0.0 0.0 1728 616 ? Ss Nov29 0:18 syslogd -m 0
2,配置 /etc/syslog.conf 文件,定义防火墙日志的 local 为 1(提示:需要与客户端配置对应,0-6 范围,因为 Linux 系统默认使用 7 来保存 boot messages 日志),并且将日志保存到文件:/home/syslog/netscreen.log
reistlin:~# vim /etc/syslog.conf
# Juniper NetScreen Firewall syslog messages
local1.* /home/syslog/netscreen.log
阅读剩余部分...
作者:reistlin
发布时间:July 29, 2010
分类:自由点击

[root@secure ~]# echo "reistlin.com" | passwd --stdin root
Changing password for user root.
passwd: all authentication tokens updated successfully.
- 1
- 2
- »