说来惭愧,我虽然知道 Linux 是王道,但迄今学得支离破碎,平时会用 SSH 玩几个 command line,一直没有亲密接触 Linux。今天终于有机会(需要静下心做这件事)开始安装 Fedora,我的目标是在 Vmware server 里安装 Fedora server,为 LAN 用户提供更多更快更稳定的应用。具体点讲,这台Fedora server将兼任 DNS server Apache http / https server Ftp / Sftp server Mysql server Svn server Samba server 我的环境是 Windows XP Host 下的 Vmware Server 2.0.0,用Fedora Live CD 安装 Fedora 10。安装过程中遇到的问题和解决方案都记录在此。 我碰到的第一个问题:无法在Fedora guest OS 里安装 Vmware Tools。 原因:need to… Continue reading My very first time setting up a perfect Fedora server
Tag: linux
Magento speed optimisation
诚然,我接触Magento时间不短了,但直到最近才开始研究Magento的速度,因为我的一个Magento项目已经上马了。 通常Magento要比Zencart, osCommerce, VirtueMart for Joomla跑得慢,但这个没有吓退我。我坚信Magento是我的方向,是因为Magento的ecommerce功能是其它软件望尘莫及的,况且我拥有让Magento加速的硬件资源。(这世界上没有什么是最好的,适合自己的就是最好的)。 我认为选择Magento,首先得有一台独立服务器。虽然我曾成功地在shared hosting环境里运行了Magento,但一个没有速度优化潜力的Magento,就算能跑,又有什么用?Magento内置了很多SEO特性,但如果页面loading time过长,Google也不会喜欢。VPS理论上也能为Magento做速度优化,但一台入门级的独立服务器与一台高性能的VPS价格相当,我会选择前者,以确保所有的优化可能。 其次得有1G以上内存,CPU差一点没关系,因为Magento的速度瓶颈在硬盘,优化手法中很多就用内存代替硬盘。 有了以上两个硬件资源,剩下的就是进行一些软件环境设置。 首先,得是Linux环境。我不是说Magento在Windows下跑不起来,我是说网上大部分建议都是针对Linux提的,除非你有一个Microsoft专家在你旁边,每当你给他一个Linux配置文件,他能为你写一个Windows下的对应文件。 其次,给MySQL Server分配更多的内存。 再次,启用Cache。Cache分三种,一是Magento data cache,Magento系统菜单的Cache Management指的就是这个,默认已经启用。据我观察,data cache单独使用时,对速度提升没多大帮助。二是Linux in-memory file cache,把magento/var/cache指到或软连接到tmpfs。三是php byte cache,开源世界里主要有三种选择,php APC, eAccelerator, xCache。孰优孰劣尚无定论,我看了一些测试结果,我的结论是:小访问量时选php APC,访问量达到负载容量50%以上的选xCache,Magento的开发小组说eAccelerator在处理magento异常时会出错,我就把它剔除了。 如果以上优化都做过了,速度应该很理想了。经济条件许可的话,买多点内存,搞个SCSI, RAID硬盘,换个四核CPU,我就不信Magento会比谁慢。
Crontab file does not accept variables
我建了一个每日自动备份的cron job,备份文件的文件含有系统日期`date +%m%d%y`,但发现crontab file里command不接受变量,导致crontab file这一行被忽略。 我只好把含变量的command专门建一个bash文件,command间接由crontab file调用。
I give up Godaddy’s DNS servers
When I first started with Godaddy, I used to use my dedicated server as a DNS server for my domains. At that time, I could only use Godaddy’s Simple Control Panel (Turbopanel in another name) to edit DNS settings. Simple Control Panel did not have export and import facility, which meant editing multiple domains’ DNS… Continue reading I give up Godaddy’s DNS servers
Apache Option FollowSymLinks
我终于意识到Apache “Option +FollowSymLinks”对我的重要性了。 以前对一些程序提供的.htaccess sample中Option +FollowSymLinks一条总是熟视无睹(比如,magento .htaccess就有这么一条),今天发现Option FollowSymLinks对我来说并非可有可无。因为我逐步摸索出的Magento一次安装,多处使用和WordPress一次安装,多处使用,都是借助于Linux软连接(symbol link)的强大功能。一旦使用Option -FollowSymLinks,我的一次安装多次使用的方案全部失灵了。
Command Line Serves Me The Best
刚在Godaddy开始使用Dedicated Server时,觉得Godaddy自己开发的Simple Control Panel还不错,所有设置都是在Simple Control Panel里完成。不知从什么时候起觉得Simple Control Panel实在不方便,主要是无法完成批量作业。于是,我慢慢摸索常用任务的命令行方式,或者直接修改配置文件。 今天凌晨我纯属好奇,想在Simple Control Panel尝试启动Linux防火墙。很早以前我试过启动防火墙,结果是Actinic无法上传文件,其他网站正常。笨笨的Actinic,但没办法,它是一个主要网站,服务器只有为它Compromise。后来有多次升级,所以我突然想看看Actinic能否与防火墙并存。 可能与平时我直接修改配置文件有关,经我修改的配置文件已经不是Simple Control Panel能看懂的了。我在Simple Control Panel里一点启动防火墙,结果所有的网站都访问不了了,要命的是连Simple Control Panel也访问不了了,我怎么才能关闭防火墙? 因为不知道学习命令行方式关闭防火墙有多难,情急之下先submit a ticket,请support把眼前的问题解决再说。然后当然不能等support回复啦,我开始Google,发现用ssh command line关闭防火墙很简单,真的,两句话搞掂。早知这么简单,我就不会花5分钟时间submit the ticket。 我又花了至少两分钟submit another ticket cancelling the request in the previous ticket。 我喜欢命令行,我喜欢SSH,另外我也喜欢Google。
httpd.conf Can Override php.ini
httpd.conf and php.ini, which has priority? I have done some experiments, and the conclusions are – php settings in php.ini can be overrided by httpd.conf (or some other Apache configuration files) with php_admin_value, php_admin_flag, php_value, and php_flag. However, I find on Linux, if php_admin_value, php_admin_flag, php_value, or php_flag can not be put inside of VirtualHost… Continue reading httpd.conf Can Override php.ini