I found that the apache service in my server is alway hang. I wan to restart apache every hour, do you know how to do it ? in cronjobs setting ?
Restarting your server every hour is not the best solution. You would also not want it even.... You can check your error logs to see what happened and fix it from there.
Do you run proxies on the server? If you use cgi proxy it can hang, try to change to zelune or phproxy.
Then block file sharing sites in .htaccess. Also block big file downloads. And redirect all direct requests to other pages than the home page back to the home page.
Put this in .htaccess, add any sites that leech from you: RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} megarotic\.com [NC] RewriteCond %{HTTP_REFERER} megaupload\.com RewriteCond %{HTTP_REFERER} depositfiles\.com RewriteCond %{HTTP_REFERER} fury-tech\.com RewriteCond %{HTTP_REFERER} rapidcat\.us RewriteRule .* - [F] ErrorDocument 404 http://www.yourproxysite.com
Better than restarting apache every hour, try to know what's wrong with it check the server CPU/RAM usage and see if your server i highly loaded then this might be the cause to crash apache Also try to tweak apache config file httpd.conf - consult your server provider or serach google for apache optimization
And if you do resort to an hourly restart, make sure you send a SIGUSR1 by using the "graceful" switch. This will then honour current connections and be transparent for users.