Dreamhost Internal Server Error故障

  9-5号访问寄存在dreamhost的www.yeeach.com主机时候,访问所有应用页面(blog、pligg、bbs、下载)都报Internal Server Error,查看服务器日志发现大量的如下错误:

[Thu Sep 04 00:41:53 2008] [error] [client 220.181.32.23] Premature end of script headers: php.cgi
[Thu Sep 04 00:41:53 2008] [error] [client 220.181.32.23] php.cgi: error while loading shared libraries: libsablot.so.0: cannot open shared object file: No such file or directory

    看来是apache出了问题,与dreamhost客服联系后,发现不是我自己的问题,近期dreamhsot对debian操作系统进行了升级,从32-bit升级到64-bit,导致原来的32-bit的php动态库不能够再使用。

   按照dreamhost提供的参考网页:

http://www.dreamhoststatus.com/2008/09/02/debian-upgrades-and-custom-php/

http://wiki.dreamhost.com/Installing_PHP5#Compiling_a_Customized_PHP_5

    看见繁琐的升级过程,头就大,也没有时间仔细去琢磨。突然想起来,前段时间遇到的upload_max_filesize时候曾经使用的shell脚本,修改Dreamhost虚拟主机的php.ini的upload_max_filesize参数限制 ,在服务器上执行了一下两个脚本,问题解决了。呵呵,看来多记笔记很有好处。

1、mkdir ~/yeeach.com/cgi-bin/

2、touch ~/php-copy.sh 

#!/bin/sh
CGIFILE="$HOME/yeeach.com/cgi-bin/php.cgi"
INIFILE="$HOME/yeeach.com/cgi-bin/php.ini"
rsync -a /dh/cgi-system/php5.cgi "$CGIFILE"
# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:
cp /etc/php5/cgi/php.ini "$INIFILE"

perl -p -i -e ‘
s/.*post_max_size.*/post_max_size = 100M/;
s/.*upload_max_filesize.*/upload_max_filesize = 100M/;
‘ "$INIFILE"

3、chmod +x php-copy.sh

4、./php-copy.sh

5、touch ~/yeeach.com/.htaccess

Options +ExecCGIAddHandler php-cgi .phpAction php-cgi /cgi-bin/php.cgi

6、 php daily  update

cp php-copy.sh php-update.sh
#the php-update.sh content is :

#!/bin/sh

CGIFILE="$HOME/yeeach.com/cgi-bin/php.cgi"

INIFILE="$HOME/yeeach.com/cgi-bin/php.ini"

rsync -a /dh/cgi-system/php5.cgi "$CGIFILE"

perl -p -i -e ‘

s/.*post_max_size.*/post_max_size = 100M/;

s/.*upload_max_filesize.*/upload_max_filesize = 100M/;

‘ "$INIFILE"

7、crontab configure

crontab -e
#the crontab's content :
@weekly /home/myusername/php-update.sh

 

参考资料:

http://www.activecollab.com/forums/topic/1507/

http://wiki.dreamhost.com/index.php/PHP.ini .

Jboss虚拟主机安装部署指南

1. 环境说明:

x.x.x.137:应用服务器,内网地址:192.168.1.137

x.x.x.180:数据库服务器,内网地址:192.168.1.180

数据库服务器和应用服务器之间通信通过内网地址通信。

2. 操作系统

操作系统版本:Redhat AS 5

安装:操作系统按照缺省的安装方式安装,无特殊要求。

由于没有硬件防火墙,因此需要安装iptables,建议不要安装selinux。

相关应用安装到/opt目录下,包括jdk、应用等。

3. 防火墙配置

防火墙策略:

只允许应用服务器x.x.x.137(192.168.1.137)访问数据库服务器x.x.x.180(192.168.1.180)的3306端口,且允许数据库服务器 x.x.x.180(192.168.1.180)能够访问应用服务器的x.x.x.137(192.168.1.137)的[1024,65535]端口(socket连接的随机端口)。

配置方法:

在数据库服务器x.x.x.180上执行如下操作:

1) 直接修改iptables的配置文件/etc/sysconfig/iptables

在:RH-Firewall-1-INPUT – [0:0]增加如下内容:

-A INPUT -p tcp -s x.x.x.137 –sport 1024:65535 -d x.x.x.180 –dport 3306 -m state –state NEW,ESTABLISHED -j ACCEPT

-A OUTPUT -p tcp -s x.x.x.180 –sport 3306 -d x.x.x.137 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

-A INPUT -p tcp -s 192.168.1.137 –sport 1024:65535 -d 192.168.1.180 –dport 3306 -m state –state NEW,ESTABLISHED -j ACCEPT

-A OUTPUT -p tcp -s 192.168.1.180 –sport 3306 -d 192.168.1.137 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

2) 重启iptables

service iptables restart

注意还要确认应用服务器(x.x.x.137)上开通了80端口,允许从公网访问:

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

4. 在域名服务器上做域名地址映射

在域名服务器上做映射,将e.yeeach.com映射到x.x.x.137地址,没有做URL指向转发

为了简化代理商销售人员记忆,避免记忆ip及复杂域名,因此采用二级域名+虚拟主机方式来实现此目标。

5. 安装JDK

使用Java SE 6 Update 6版本

wget -O jdk-6u6-linux-i586.bin \

http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u6-linux-i586.bin?BundledLineItemUUID=A_JIBe.mKjcAAAEZ.0gv8eBL&OrderID=dy5IBe.mH10AAAEZ70gv8eBL&ProductID=VXZIBe.ootIAAAEZTrBAkQve&FileName=/jdk-6u6-linux-i586.bin

chmod 755 jdk-6u6-linux-i586.bin

./jdk-6u6-linux-i586.bin  

mv  jdk1.6.0_06/ /opt/jdk

修改/etc/bashrc(或者也可以修改用户的bash配置文件:~/.bashrc_profile) ,在尾部增加如下内容:

export JAVA_HOME=/opt/jdk

export PATH=$JAVA_HOME/bin:$PATH

6. 安装Jboss 4.2.2

wget http://jaist.dl.sourceforge.net/sourceforge/jboss/jboss-4.2.2.GA.zip

unzip jboss-4.2.2.GA.zip

mv jboss-4.2.2.GA  /opt

7. 增加Jboss APR支持

参看使用APR( Apache Portable Runtime)来提升jboss性能

wget http://www.jboss.org/file-access/default/members/jbossweb/freezone/dist/2.0.4.GA/jboss-native-2.0.4-linux2-x86-ssl.tar.gz

mkdir jboss-native

mv  jboss-native-2.0.4-linux2-x86-ssl.tar.gz  jboss-native/

cd jboss-native/

tar zxvf jboss-native-2.0.4-linux2-x86-ssl.tar.gz

mv  bin/META-INF/bin/linux2/x86/*  /opt/jboss-4.2.2.GA/bin/

mkdir /opt/jboss-4.2.2.GA/bin/native

cp –r bin/META-INF/lib/linux2/x86/*   /opt/jboss-4.2.2.GA/bin/native

8. 修改Jboss 参数

1) 修改JVM参数

修改bin/run.conf,修改参数:

if [ "x$JAVA_OPTS" = "x" ]; then

         JAVA_OPTS=”-Xms512m -Xmx1024m -server -XX:MaxPermSize=300m -XX:MaxNewSize=300m -server -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000″

fi

2) 修改jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/server.xml,将

将8080修改为80

将${jboss.bind.address}修改为0.0.0.0,允许从eth0,eth1,lo都能够访问jboss 80端口

  也可以在启动参数中指定ip地址选项,指定绑定的ip地址:run.sh -b x.x.x.137
9. 去除jboss的冲突包

由于jboss自身带的hibernate-annotations.jar版本与项目使用的版本存在冲突,因此去除hibernate-annotations.jar包

mv /opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar /opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar.bak

 
10. 部署esales.war到/opt/jboss-4.2.2.GA/server/default/deploy

修改数据库连接池等应用相关参数

11. 增加虚拟主机Host节点

在/opt/jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/server.xml 中的 Engine加一个 Host 节点,内容如下:

<Host name=”esales” autoDeploy=”false”         

      deployOnStartup=”false” deployXML=”false”>

    <Alias>e.yeeach.com</Alias>

    <Valve className=”org.apache.catalina.valves.AccessLogValve”

           prefix=”esales” suffix=”.log” pattern=”common”         

           directory=”${jboss.server.home.dir}/log”/>

    <DefaultContext cookies=”true” crossContext=”true” override=”true”/>

</Host>

12. 在eSales应用中配置虚拟主机

在/opt/jboss-4.2.2.GA/server/default/deploy/esales.war/WEB-INF下创建文件jboss-web.xml,内容如下:

<jboss-web>

    <context-root>/</context-root>

    <virtual-host>e.yeeach.com</virtual-host>

</jboss-web>

 

 

dreamhost虚拟主机购买记

在dreamhost上购买了一个虚拟主机,记录一下整个过程,供有一天成为写传记时候,让传记作者帮写回忆录时候说明是多么的与时俱进,竟然冒着被河蟹掉的危险,突破重围,投奔革命圣地。(呵呵,my god,伟大任务的传记就是这样出炉的)!

1、选择篇

简单看了hostgator,ixwebhosting,godaddy,bluehost后还是决定在hostmonster.com 和dreamhost.com 之间选择,也无什么具体原因,主要没有兴趣一个一个比较价格、服务等,查看各种评论和比较,更加迷茫,还是顺便选择一个吧,免得心烦。

最后在hostmonster和dreamhost之间选择了dreamhost,主要是觉得hostmonster一年的费用$83.4的价格比dreamhost的$22.4(使用Promo Code: adminis97)贵了一大截。hostmonster两年包费用为$4.95*24=118.8,dreamhost两年包的费用为:$214.8-$97=$117.80。价格上还是dreamhost占优。

2、支付篇

直到注册时候才发现dreamhost.com只支持google checkout,晕倒,前面看其他帖子明明说dreamhost.com支持paypal,应该是最近与google达成了所谓的“战略合作伙伴”。只好在注册一个google checkout,只不过也好,也体验一下这些支付厂商的服务细节。

  • 为何一定要用第三方支付,而不直接使用信用卡支付?

直接用信用卡支付要向虚拟主机提供商提供自己信用卡的号码、有效日期、CVC等敏感信息,这些信息如果泄露出去,对于信用卡资金的安全、用户私人信息等都有重大的安全漏洞。通过第三方支付工具,这些敏感信息只驻留在第三方支付厂商处。支付时候虚拟主机厂商与支付厂商间只传递订单金额(Amount)、商家交易号(Transaction ID)、支付商订单号(Order)、支付时间等基本信息,并不存在泄露用户信用卡相关信息,因此相对安全。另外如果要评比虚拟主机提供商和像google checkout、paypal这样的第三方支付商的可信度,我宁愿选择第三方支付商,毕竟支付的专业性、安全性是他们的立足之本。

注册过程倒没有什么特别的,只不过在选择Location时候还没有China或PRC可供选择,只能选择Hong Kong了事。我自己用的是招行的Visa信用卡,注册验证过程倒比paypal便捷。

checkout

另外注册时候要求填入信用卡的验证号CVC(Card Verification Code),是指信用卡背面的签名最后的3位的数字。

cvc_visa

PS.

google checkout的帐号应该是根据google account生成的,从设计上来说对应客户(customer)-用户(user)-帐户(account)这电信所谓的三户模型而言,account=google checkout ,user=google account。

3、注册篇

3.1、折扣

注册前最好google一下,看有无最新的折扣信息。 google关键词“Dreamhost promo code”,找个折扣号。

注意不要使用google.cn,出来的很多垃圾信息。可以使用http://www.google.com/ncr 或者http://www.google.com/search?hl=en&q=Dreamhost+promo+code

3.2、注册

注册过程倒没有什么技巧,主要有几个地方备忘一下:

“Now for the up-sell:”中的所有东西在注册时候时候都可以不选择,尤其是SSL Secure Certificate,注册时候还以为必须选择此项,才能够使用诸如F-Secure SSH登录,由于必须同时选择“Unique IP”服务,觉得太贵,也就没有选择,打算就telnet+ftp方式进行维护算了,后来发现其实仍然可以用SSH方式进行登录上传文件。SSL协议支持两种传输过程,需要用户验证的双向验证传输(双向认证,需要客户端安装数字证书),和不需要用户验证的单向验证传输(服务器端认证,不需要客户端安装证书)。此处的“SSL Secure Certificate”应该是指“不需要用户验证的单向验证传输”。

  • 关于Promo Code or email of who referred you:

要看仔细了,要在此处输入Promo Code。我使用的是“adminis97”,可以在原有方案折扣的基础上享受$97的优惠。

4、开通篇

4.1、DreamHost Account Approval Notification

dreamhost的开通速度还不错,我付款后,大致才过了30分钟就收到了开通信“DreamHost Account Approval Notification!”,内容如下:

(Account #123456)
*** Please visit the Wiki for help getting started :
http://wiki.dreamhost.com/index.php/Special:Search?fulltext=Search&search=getting%20started
Hello xxx,
This is just a note to let you know that your account with DreamHost has
been approved! Below you will find a summary of relevant services for
your account that will be activated within the next 30 minutes:
Domain yeeach.com : Web service on dione.dreamhost.com
 FTP User 'xxx', password 'xxx' on machine dione.dreamhost.com
Mail User 'xxx', password 'xxx'
As each of these services is activated, you will receive another email
that more fully details its use.
If you are transfering an existing domain registration to DreamHost for
hosting - or have not yet registered your domain and plan to do so with a
registrar other than DreamHost - remember to use the following domain name
server information when submitting your registration/transfer:
 Primary name server: ns1.dreamhost.com 66.33.206.206
 Secondary name server: ns2.dreamhost.com 208.96.10.221
 Tertiary name server: ns3.dreamhost.com 66.33.216.216
 Finally, you can administer virtually every aspect of your account from
the web panel at:
 https://panel.dreamhost.com/
Your email: xxxx@xx.com
Password: xxx
 Any questions about your account can be submitted from the 'Support'
area of our web panel.
 Thank you for choosing DreamHost!
 Sincerely,
The Happy DreamHost Approval Team
 --
support@dreamhost.com
https://panel.dreamhost.com/
"We host your dreams"
FAX: +1-714-990-2600

4.2、管理控制台

https://panel.dreamhost.com/
  • 查看订购的服务:
查看invoice:https://panel.dreamhost.com/index.cgi?tree=billing.invoice&
域名管理:https://panel.dreamhost.com/index.cgi?tree=domain.manage&
  • 安装应用:
dreamhost缺省提供了日常建站需要的各种应用(包括:wordpress、joomla、Mediawiki等),再不用一个一个下载、上传、安装了。
这些应用可以通过One-Click Installs安装:
 https://panel.dreamhost.com/index.cgi?tree=goodies.installer&
mysql管理:
 https://panel.dreamhost.com/index.cgi?tree=goodies.mysql&
crontab:
 https://panel.dreamhost.com/index.cgi?tree=goodies.cron&
subversion:
 https://panel.dreamhost.com/index.cgi?tree=goodies.svn&
Jabber:
 https://panel.dreamhost.com/index.cgi?tree=goodies.jabber&
  • 修改缺省密码:
由于缺省生成ftp、mail的密码为随机密码,因此把这些改成自己熟悉的安全密码。
  • 常用地址备忘:
 1、SSH或telnet、ftp地址:虚拟主机名称,例如www.yeeach.com 或dione.dreamhost.com
 dione.dreamhost.com 是虚拟主机的实际存放地址,后端应该有负载均衡、cluster,能够根据用户id负载到相应的虚拟主机上,
 2、管理终端登录界面:https://panel.dreamhost.com/
 3、wordpress管理登录界面:http://www.yeeach.com/wp-admin


Technorati 标签:,,,,,,