记录 FreeBSD

./configure -prefix=/usr/local/php -with-config-file-path=/usr/local/php/etc -with-mysql=mysqlnd -with-mysqli=mysqlnd -with-iconv-dir=/usr/local/bin -with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg -with-png-dir=/usr/local/libpng -with-zlib -with-libxml-dir=/usr/local/libxml -enable-xml -disable-rpath -enable-discard-path -enable-safe-mode -enable-bcmath -enable-shmop -enable-sysvsem -enable-inline-optimization -with-curl -with-curlwrappers -enable-mbregex -enable-fastcgi -enable-fpm -enable-force-cgi-redirect -enable-mbstring -enable-mcrypt --with-mcrypt=/usr/local/libmcrypt -with-gd=/usr/local/gd -enable-gd-native-ttf -with-openssl -with-mhash -enable-pcntl -enable-sockets -enable-soap -with-xmlrpc -enable-zip -disable-ipv6 -without-pear -with-iconv=/usr/local/libiconv

make ZEND_EXTRA_LIBS='-liconv' 

shutdown -h now halt
shutdown -h now reboot

/usr/local/bin/memcached -d -m 10  -u root -l 127.0.0.1 -p 11211 -c 256 -P /tmp/memcached.pid 
kill `cat /tmp/memcached.pid`
dmesg 
freebsd 系统状态查看
用以下方法检查系统状态:

   1. Top
   2. netstat -m
   3. pstat -T
   4. systat -if 1
   5. q
 kill -HUP 1
/etc/rc.d/sshd restart
tail /var/log/messages


portsnap fetch extract  第一次更新时用

portsnap fetch update  以后更新时使用


FETCH_CMD=axel
FETCH_BEFORE_ARGS= -n 10 -a
FETCH_AFTER_ARGS=
DISABLE_SIZE=yes

netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
netstat -nat|grep -i "80"|wc -l
服务器上的一些统计数据:

1)统计80端口连接数

netstat -nat|grep -i "80"|wc -l

1

2)统计httpd协议连接数

ps -ef|grep nginx|wc -l
ps -ef|grep php-fcgi|wc -l

1

3)、统计已连接上的,状态为“established'

netstat -na|grep ESTABLISHED|wc -l

2

4)、查出哪个IP地址连接最多,将其封了.


netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r +0n 
netstat -na|grep FIN_WAIT_1|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r +0n
netstat -na|awk '{print $5}'| sort | uniq -c | sort -r | awk -F' ' '{if ($1 > 50) print $2}'

netstat快速查看一下TCP连接情况
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
通过man netstat可以了解SYN_RCVD的意义。SYN_RCVD表示当前未完成的TCP SYN队列

用命令:

  # netstat -an | grep SYN | wc -l

$netstat -an | grep SYN_RECV | wc
97     582    7857
$netstat -an | grep 80 | wc
916    5500   74164



SERVERNAME=portsnap.hshh.org

[root@bsd01 ~]# portsnap fetch
[root@bsd01 ~]# portsnap extract
[root@bsd01 ~]# portsnap fetch extract


[root@bsd01 ~]# portsnap fetch
[root@bsd01 ~]# portsnap update
[root@bsd01 ~]# portsnap fetch update


你可能感兴趣的:(FreeBSD)