Oct 23

whm/cpanel – SoftException in Application.cpp: Directory / is not owned by

in a sudden,all website throw out “500 internal server error”. i got those message from apache error log:

[Tue Oct 22 16:28:27 2013] [error] [client 95.108.217.252] SoftException in Application.cpp:592: Directory / is not owned by falc0961
[Tue Oct 22 16:28:27 2013] [error] [client 95.108.217.252] Premature end of script headers: index.php

Yes, the php is runnning in su_php mode. so this maybe caused by permission.i got no clue after i check the doc root of the related website. the owner and permission is ok.

At last i put my attention on the error log

—- SoftException in Application.cpp:592: Directory / is not owned by falc0961.

i don’t know why it check the root directory.but when i found out that the root is belong to some user id other than root user.so i fix the problem with the simple chown command as:

chown root.root /

(it was casued by copying some directory content to root directory,which overwrite the . file.)

 

Oct 19

apache — 301 redirect from long domain www.abcdomain.com to short abcdomain.com

For search engine, www.abcdomain.com and abcdomain.com are different domain.For seo purpose,we need to do 301 redirect to tell search engine to  treat the two domain as one.

To redirect long form domain with www to the domain without www,you can use the rewrite rule below.this can help you save time if you have lots of websites.

RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.([a-z]+)$
RewriteRule (.*) http://www\.%1\.%2/$1 [R=301,L]

OR

RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.([a-z]+)$
RewriteRule (.*) http://www\.{HTTP_HOST} [R=301,L]

On the other way,if you prefer to keep short form domain,you can adapt the rule to:

RewriteCond %{HTTP_HOST} ^www.([a-z0-9-]+)\.([a-z]+)$
RewriteRule (.*) http://%1\.%2/$1 [R=301,L]

Oct 17

linux — forward user email

To forward user’s email,just put an .forward file with the email addr in the user’s home diretory.If this not work for your server,Make sure the .forward file is belong to the user you want to forward email.for example,if you want to forward all email for user testuser, change current working directory to /home/testuser,touch a .forward file.

# cd /home/testuser
# touch .forward
# echo ‘abctest@abc.com’ >> .forward
# chown testuser.testuser .forward
# chmod 664 .forward

if this not work,you may check the log file located at /var/log/maillog for more info.

And keep in mind,only in a Postfix/Sendmail system it is sendmail command that utilies this file.For other situation,you may check the related document.