Archive for February, 2009

Jasmax finalist on the SXSW Web Awards

Monday, February 16th, 2009

Jasmax.com, a website I have been working on at Fracture Media Syndicate, made it as finalist in the SXSW Web Awards this year!

The finalists of each category will be revealed on March 15.

Shell scripting

Friday, February 13th, 2009

A good link to go beyond the very basics in Shell scripting:

http://www.hsrl.rutgers.edu/ug/shell_help.html

Testing client-side performance

Thursday, February 12th, 2009

A great tool discovered on Eric Daspet’s blog [French]
http://performance.webpagetest.org:8080/

This tool makes a thorough analysis of your website, client-side, and propose you detailed tips to improve its performance (compression, file merging, file minifying, …)

Apache: redirect http://www.mydomain.tld to http://mydomain.tld

Wednesday, February 11th, 2009

It is useful to make your website available both with and without “www” as url prefix, in order to bring in people not sure about your exact url.

However, it would also impact your SEO, as search engine will consider both urls as distinct sites, each taking half of the fame.

A common solution is to have one of the url redirected to the other one – the search engines understand the corresponding HTTP “redirect” and consider that the two urls are n fact the same site.

DNS configuration

You first need to setup your DNS records, to have both url
mydomain.tld
and
www.mydomain.tld
pointing to the IP of your web server.

Apache configuration

An easy way to do this redirect with Apache is to define two VirtualHosts, as follow (here the www is redirected to the non-www):

NameVirtualHost *:80

<VirtualHost *:80>
ServerName mydomain.tld
ServerAdmin admin@mydomain.tld
DocumentRoot /path/to/my/web/folder/
</VirtualHost>

<VirtualHost *:80>
ServerName www.mydomain.tld
RedirectMatch 301 (.*) http://mydomain.tld$1
</VirtualHost>

So here two virtual hosts are defined.

The requests “mydomain.tl”, matching the ServerName defined in the first VirtualHost, will get served the files defined in the corresponding DocumentRoot directive.

The requests “www.mydomain.tld”; matching the ServeName defined in the second VitualHost, will inform the browser that the url it requested is permanently redirected to the url without www.
So for example; if a browser sent a request to http://www.mydomain.tld/about.html, the Apache server will tell the browser that this page is now to be found at http://mydomain.tld/about.html.

More details on the corresponding apache directives

NameVirtualHost is the IP (and possibly port) of the requests to be served by the VirtualHosts.
So if your servers has only one IP address, or if all the IPs have to be served by the VirtualHosts, you can use * (as in this example)

The argument of the <VirtualHost> directive must match with the NameVirtualHost value.

ServerName is the value the server tries to match with the requested url. If it matches, then the configuration defined in the corresponding VirtualHost is used.

DocumentRoot is the webroot folder path.

RedirectMatch redirects using regular expressions (requires mod_alias). Matches the url path (exclude the domain.tld)
In our example:
- matches any url path “.*”
- captures the path (thanks to the braces)
- redirect to mydomain.tld/theMatchedUrlPath ($1 means the string matched within the braces)

Sources

http://httpd.apache.org/docs/2.2/en/vhosts/name-based.html
http://www.301-redirect.net/fr/ [french]

performance testing: WebLOAD

Tuesday, February 10th, 2009

In my quest of free performance testing tools, I found today WebLOAD.

This tool’s purpose is to simulate a heavy user load on your web server, and find out from how many users your web application start suffering.

To summarize, to simulate load, you start by recording a browsing session to your website (from your browser). WebLOAD records it as script (that you can modify), then let you play it by as many Virtual Users as you want, for as long as you want. During the testing, it gives you some data (response time, HTTP errors, …) to let you know to some extend how the server is handling the load.

I previously used OpenSTA, a similar tool (open source as well), but I always found it a bit heavy, and the test scripts (generated from the browser session recording) a bit hard to customize. Plus, during my tests today I just could not make it work – hence my decision to try something else.

Quick comparison between WebLOAD and OpenSTA

WebLOAD does indeed make the scripting a bit easier and user-friendly. (at least, defining variables is straight-forward; OpenSTA requires a bit more code, and I found the documentation too dense)

On the other hand, OpenSTA has some other powerful features:

  • the tests reports are much more thorough with OpenSTA. You can even put deamons on the server  to monitor it (memory, disk usage, processes…), OpenSTA can integrates this data in the reports.
  • you can split the load generation (the virtual users) over several machine,s whereas WebLOAD does not allow you to do that (you need to buy the professional version proposed by RADVIEW) – so for example, I am stuck on my laptop to a max of about 40 simlateneous virtual users, as my machine cannot handle more.

Web server monitoring: Munin

Sunday, February 8th, 2009

A usefull tool to monitor your server(s): Munin
Gives you provision to easily monitor memory, proc, processes, apache, mysql and much more; and provides you a web interface to see all that at a glance.

And a usefull tutorial, in French: http://www.crashdump.fr/tutoriels/munin-le-top-du-monitoring-3/
(But I am sure there are plenty around in English!)

Installing APC

Saturday, February 7th, 2009

For the last website I am working on, I figured I would try to setup a php accelerator (even though I don’t think it would really be required for the first few weeks after the launch).

So below are the steps I had to follow, on my Debian server.

Installation

1) PEAR, the php extension manager, must be installed

apt-get install php-pear

2) php-dev, which provide building tools (like phpize), also

apt-get install php-dev

3) apache2-dev, which provide apxs (used to build to apc module), as well

apt-get install apache2-dev

4) then finally, install apc

pecl install apc

PHP configuration

1) Enable the module in php.ini:

extension=apc.so

2) Set the following values

[apc]
apc.enabled=1
apc.shm_size=30
apc.ttl=7200
apc.user_ttl=7200

Results

A very quick test show me an improvement of the server-side processing time of a factor of about 2. (without any tweeking) Not bad!

I will probably play around a bit more in a few weeks.

sources:
http://fr3.php.net/apc
http://www.agnivo.com/tech/cache-php-scripts-with-apc-pecl-module-100.html

SEO

Friday, February 6th, 2009

Various resources on SEO (Search Engine Optimisation).
Any additional (valuable) suggestion welcome!

Online tools: start your SEO

  • Website Grader
    Providing a url, returns a grade for the site, and a decent amount of tips to improve your SEO.
  • Google Keyword Tool
    From either a URL or keywords, generate a list of popular search requests.
    As Google does not use much the <meta> keywords, I guess those are rather to be smartly integrated in the site content.
  • Sitemap builder
    Generate your sitemap from a url
  • AddThis
    a toolbar to let your users bookmark/share your site in plenty of social bookmark sites, and more.

Online tools: follow up your SEO

  • Website Grader
    Can also be used to follow up your SEO progress.
  • xinureturns
    Quite complete tool, “Check PageRank, Backlinks, Indexed Pages, Rankings and more”
  • Popuri.us
    Check the rank/popularity of your website against several search engines / social bookmarks / subscribers
  • Link checker
    Check the inbound links to your site
  • Backtags
    Check your site in 20 social bookmark sites

Directories

Resources

Web analytics: piwik

Friday, February 6th, 2009

A short one tonight, as it’s getting late:

A good alternative to Google Analytics, but with which you own your data (and much more):

piwik

Emails received in spam folder in hotmail

Tuesday, February 3rd, 2009

I faced recently a common problem I already had some time back: the mails I send from the website I am working on end up in the spam folder if the recipient uses Hotmail. The first time I met with this issue,  the same went for Gmail users – but not this time; either Google improved their filtering, or my messages content are more relevant.

Anyway: as per Microsoft website, a solution to that is to implement the SenderId protocole.

It simply consists in adding to the DNS entry for your website a Text entry (called SPF Record), as per a format defined by the SenderId protocole. This record specifies which IP address is authorized to send mails for a specific domain name. It prevents an illigitimate mail server to send emails from a domainname it does not own.

Microsoft even provides a wizard to generate the SPF Record.