Blog运行方案由Nginx+PHP-FPM切换到OpenLiteSpeed

Litespeed原本是一个商业软件,最近发布了开源版的Litespeed,减少了部分特性,但是开源版并不减少整体的稳定性和易用性.下面是几个我更换WebServer的原因.

1.Litespeed附带一个管理面板,可以很方便的对服务器进行管理,能很简单的添加/删除/编辑虚拟主机.

2.Litespeed支持Nginx所支持的大部分特性,例如,反向代理,等

3.Litespeed支持Nginx不支持的Spdy 3

4.Litespeed 兼容Apache的.htaccess Rewrite格式(虽然开源版不支持文件.htaccess).

2014.06.04补充:
又换回LNMP了.

Centos MariaDB 5.5.35 编译失败解决办法

在某些Centos上编译MariaDB 5.5.35在make的时候可能会出现以下问题:

root@wsi:/root/src/mariadb-5.5.35# make
.......
[  8%] Building C object mysys/CMakeFiles/mysys.dir/my_context.c.o
cd /root/src/mariadb-5.5.35/mysys && /usr/bin/gcc  -DHAVE_CONFIG_H -Wall  -march=i686 -fPIC -O3 -DNDEBUG -DDBUG_OFF -I/root/src/mariadb-5.5.35/include -I/root/src/mariadb-5.5.35
/mysys    -o CMakeFiles/mysys.dir/my_context.c.o   -c /root/src/mariadb-5.5.35/mysys/my_context.c                                                                              /root/src/mariadb-5.5.35/mysys/my_context.c: Assembler messages:
/root/src/mariadb-5.5.35/mysys/my_context.c:457: Error: CFI instruction used without previous .cfi_startproc
make[2]: *** [mysys/CMakeFiles/mysys.dir/my_context.c.o] Error 1
......

使用以下pactch可以解决编译失败的问题.

--- mariadb-5.5.35/include/my_context.h.org       2014-02-02 21:59:28.724573324 +0800
+++ mariadb-5.5.35/include/my_context.h   2014-02-02 21:59:46.550625376 +0800
@@ -25,17 +25,7 @@
   (This particular implementation uses Posix ucontext swapcontext().)
 */
 
-#ifdef __WIN__
-#define MY_CONTEXT_USE_WIN32_FIBERS 1
-#elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__x86_64__) && !defined(__ILP32__)
-#define MY_CONTEXT_USE_X86_64_GCC_ASM
-#elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__i386__)
-#define MY_CONTEXT_USE_I386_GCC_ASM
-#elif defined(HAVE_UCONTEXT)
 #define MY_CONTEXT_USE_UCONTEXT
-#else
-#define MY_CONTEXT_DISABLE
-#endif
 
 #ifdef MY_CONTEXT_USE_WIN32_FIBERS
 struct my_context {

Linux使用smartctl检查服务器硬盘状况

1.安装smartmontools.

#CentOS
yum install smartmontools

2.查询通电时间及通电次数

[root@wsi ~]# smartctl -a /dev/sda | grep -E "Power_On_Hours|Power_Cycle_Count"
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       3987
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       24

3.错误日志查询

[root@wsi ~]# smartctl -l error /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-042stab084.17] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
No Errors Logged

4.完整检测

[root@wsi ~]# smartctl -t long /dev/sdb
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-042stab084.17] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 122 minutes for test to complete.
Test will complete after Sun Feb  2 03:45:23 2014

Use smartctl -X to abort test.

#通过该命令进行磁盘的扩展彻底检查 (大约要持续数小时,应该在低负载进行如果发现错误,基本可以说明需要更换硬盘)

5.查看完整检测日志:

[root@wsi ~]# smartctl -l selftest /dev/sdb
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-042stab084.17] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      1120         -

Cent0S Tunnelbroker IPV6隧道自动加载

因为服务器ISP给的IPV6不知道什么原因挂掉了.不得不使用Tunnelbroker的IPV6隧道,但是如果使用官方介绍的Linux-net-tools方法进行设置的话,在重启服务器或者执行service network restart之后,IPV6设置会丢失,为了解决这个问题,在各种GOOGLE之后终于找到了一个完美的解决方案.

QQ20140202-2

1.编辑/etc/sysconfig/network,加入以下内容来打开IPV6和设置默认网关:

NETWORKING_IPV6=yes
IPV6_DEFAULTDEV="sit1"

2.编辑/etc/sysconfig/network-scripts/ifcfg-eth0,加入默认IPV6网关地址,请参考上图.
P.S:ifcfg-eth0为你的网卡配置文件,请根据自己的实际情况修改

IPV6ADDR=IPV6网关

3.创建/etc/sysconfig/network-scripts/ifcfg-sit1 配置文件

ONBOOT=yes
DEVICE=sit1
BOOTPROTO=none
IPV6INIT=yes
IPV6TUNNELIPV4=隧道服务器的IPV4
IPV6TUNNELIPV4LOCAL=本机的IPV4地址
IPV6ADDR=本机IPV6开始地址

4.设置完成后,执行/sbin/service network restart,IPV6隧道就应该可以正常工作了,并且在重启之后系统也可以自动加载IPV6地址.

[root@wsi ~]# ping6 ipv6.google.com
PING ipv6.google.com(ord08s08-in-x0e.1e100.net) 56 data bytes
64 bytes from ord08s08-in-x0e.1e100.net: icmp_seq=1 ttl=58 time=13.4 ms
64 bytes from ord08s08-in-x0e.1e100.net: icmp_seq=2 ttl=58 time=13.1 ms
64 bytes from ord08s08-in-x0e.1e100.net: icmp_seq=3 ttl=58 time=13.1 ms
^C
--- ipv6.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2589ms
rtt min/avg/max/mdev = 13.119/13.220/13.421/0.194 ms