Author: 芳草苑主

  • SERVER_NAME vs HTTP_HOST

    If server_name is something like “*.mydomain.com”, $server_name is exactly “*.mydomain.com”. If $server_name is passed on to fastcgi_param as SERVER_NAME, in the program, for example, php $_SERVER[‘SERVER_NAME’] will be exactly “*.mydomain.com”. However, _SERVER[“HTTP_HOST”] shows the value most of us would expect, i.e. the host name in the address bar.

    In Nginx, I have set up a mechanism to install some popular scripts once, and use in multiple websites. I do not want people to find these websites are run under one roof. But if I write multiple websites in one line:

    
    server_name domain1.com domain2.com domain3.com;
    
    

    $_SERVER[‘SERVER_NAME’] is always assigned domain1.com no matter the host is domain2.com or domain3.com.

    To avoid that, I have to break three websites into three server block in nginx.

    $_SERVER[‘HTTP_HOST’] is always the host. But I can not control how people write the script. Breaking hosts into separate server blocks is recommended.

  • Nautilus mount

    Nautilus is quite good, easy to use in regards to its mount feature. It can automatically “mount” Windows Share via smb:// protocol. However, some software, e.g. FileZilla (now 3.2.4.1) can not read from or write to smb:// protocol. A genuine Linux mount is more helpful than Nautilus mount.

  • Problem with newly created accounts at Google Apps Mail

    I had a very bad day yesterday with Google Apps Mail. This service is good overall, but this time was exception.

    I newly set up a Google Apps account and created several user accounts last Friday. I used my administrator account to login and did some settings. Yesterday when other users wanted to login Google Apps Mail, they encountered this error:

    The page isn’t redirecting properly

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    * This problem can sometimes be caused by disabling or refusing to accept
    cookies.

    The symptom was – Google was jumping between www.google.com and mail.google.com in an endless loop. I tried various browsers on different machines and had the same problem. Only Google Apps Mail was affected, while Google Apps Calendar, Documents and Sites were all right. And only user accounts created last Friday but never login until Monday were affected, while my account and newly created test account on Monday were all right.

    I tried all suggested solutions in vain –

    • clear cookies
    • restart browser, even machines
    • disable and re-enable Mail, Docs service
    • login as a mobile user
    • change “passive” and “rm” parameters in redirecting url

    I tried to report this problem to Google but found nowhere to report (just because it is a free standard account?) I suppose it was a synchronisation problem among Google millions servers, which could be solved by itself giving time. However I was not sure of the time scale, so the final solution came up at the cost of losing incoming emails during weekends –

    I deleted user accounts and re-create them. (Here comes another episode – Google won’t allow a newly deleted account being created within 5 days. The workaround is creating another user account and aliasing the old one.)

  • Fpmforge causes depsolving problems

    我其中一个  Fedora 安装有很多 repositories,不能用 yum update 很久了,update 时总是出错。今天静下心来看看,其实太简单了,其中一个错误提示里就指出

    perl-DBD-mysql-4.012-1.el5.rf.x86_64 from rpmforge has depsolving problems

    我以前怎么就没仔细读呢,这里不是指出就是 rpmforge 导致依赖解析问题嘛,把它删了就没事了。我记不得以前为什么要加 rpmforge 进 yum repositories,反正现在用不着了。终于见到久违的——

    Transaction Summary
    ================================================================================
    Install     11 Package(s)
    Update     293 Package(s)
    Remove       0 Package(s)

    Total download size: 580 M
    Is this ok [y/N]: y

  • I do not like Apple

    我不喜欢 Apple,原因太多了:

    1. 不能接受 Apple 的海盗逻辑。很早以前看到的介绍 Apple 的文章,说 Apple 总部挂海盗旗倡导一种独立独行的风格。独立独行有多种理解,但在 IT 行业搞独立独行就是不遵守标准,给用户带来不便,我看 Apple 也自讨苦吃,独立独行打不开市场份额。
    2. 鼠标只有一个键。因为用户搞不清楚该按哪个键?那也把用户想得太傻了,是不是微波炉、电视机也造一键式?
    3. 性能算高端,但贵得离谱。我不会把钱花在时装上,同样不会花在 Apple 的设计上。
    4. 东西可用性太差。老婆不听我劝告,买了 iphone,用过才说不好用。我想我一直说 Apple 的东西不好,但没有调查就没有发言权,所以既然有了 iphone,我有时也借来玩玩,就算调研吧。你不要说我说一套做一套,我真的不喜欢 iphone,但家里只有那一个玩意可以在厕所里上上网(我的手机两年没升级了,没法连接 WPA2),尽管用起来不方便,总好过没得用吧。
    5. 老婆跟我提过,iphone 装了 skype,在 3G 网络中无法用,只有在 wifi 中用。我以为是她没设置妥当,但实在没兴趣去折腾 iphone,昨天看新闻,才知道 iphone 本身就限制 voip 在 3G 中使用。那新闻还提到,Apple 没批准 Google Voice 进入 Apple App Store,理由一大堆。在我看来,Apple 就是怕开放应用。就让它怕去吧,就如独立独行一样,越怕越限制就把路越走越窄。

    P.S.  新闻提到,Apple 规定至少2人 review 一个 app,现有 40 fulltime app reviewers,已经 review 了 200,000 个 app。我就想不通了,Apple App Store 出来没几年吧,平均每人 review 了 10,000 个app?什么 review 质量啊。

  • Google Apps Mail alternative

    There is not an alternative to Google Apps Mail, which is free, configurable, and powerful.

    Currently the only way of swapping primary domain of Google Apps is – remove the alias domain and re-setup as new.

    In order to keep receiving emails during swapping primary domain, I have to find another email service provider for the transmission period. I am not surprised I can not find any. Google is good, which is why I am using it, but its uniqueness is not a cheerful thing for business. I have never practised on a mail server just because google apps mail is taking care of everything.

    It challenged me finding another email service provider, and finally I gave up. I used email forward service from my domain registrars and forwarded incoming emails to another google apps account.

    Google offer 50 users apps as standard for free. When my business grow over this figure, I prefer my own mail server(s) rather than paying google. It is a shame to be pushed to pay someone.

  • Intranet transport via internet ip address

    我有两台机子处于同一个内网,都有独立外网 IP。A 机用 http://ip_address/file 访问 B 机,如果 ip_address 为内网 IP,下载速度接近硬盘的读写速度极限;如果 ip_address 为外网 IP,下载速度为 2MByte/s,远低于内网速度,但又远高于 internet 速度(我用的是 2Mb 下行、0.5Mb 上行的 ADSL)。

    想来想去,我只好做以下解释:ip_address 为外网 IP 时,数据流经过 router,但不经过 internet,小小的 router 数据处理能力有限,每秒只能中转 2MB 的数据。这是个 ADSL2+ router,设计能力就是为了应付 24 Mb 二代ADSL,所以能处理 2MB/s 的数据就达到了它的设计要求。

  • Magento compilation does not help if php is already optimised

    实测了一下,在已做了一些 Magento 速度优化措施以后,如 php opcode,memcache,mysql query cache,再启用 Magento 编译,速度并未提高,request per second 反而从 11 降为 8。

  • Fix Postfix in Virtualmin

    今天在安装 Virtualmin for Webmin 时碰到一个问题:启用 Postfix 时出错,出错信息为:

    A problem was found with your Postfix virtual maps : No map sources were found in the Postfix configuration

    解决方法是: edit the /etc/postfix/main.cf file and add:

    virtual_alias_maps = hash:/etc/postfix/virtual

  • I can dislike vtigercrm just for one little thing

    vtigercrm 早期版本安装总不顺利,最近下了 5.1.0 版,希望看到它有改进,但还是失望。

    原因是我在安装时设定的密码含有非字母数字字符,vtigercrm 也没说这样不可以,还告诉我安装成功。可我总是登录不了,一时没想到是特殊字符的原因,以为是我输入错误或其他原因,于是拆了重装了好几次,均无法登录。

    用了密码重置为 admin/admin 的办法,终于得以登录:

    update vtiger_users set user_hash=’21232f297a57a5a743894a0e4a801fc3′, user_password=’adpexzg3FUZAk’,confirm_password=’adoY/6Mlw8kqg’,crypt_type=” where user_name=’admin’;

    然后尝试着修改密码成我想要的密码,就算含有对 vtigercrm 非法的字符,vtigercrm 也没有阻止我修改,只是不让我登录,很不友好,我不喜欢。