Archive for July, 2010

How to set up Expires header with Apache2 on Ubuntu Lucid 10.04

A very good way to reduce page load time on your website is to tell your visitors' browser it can cache some specific files and save a copy on the disk.
This process is done by your web-server which is sending an Expires header and a max-age header during the HTTP response, e.g.:

200 OK
Cache-Control: max-age=604800
Connection: close
Date: Tue, 27 Jul 2010 22:31:03 GMT
Accept-Ranges: bytes
ETag: "2c956-376b-4696cb8b385c0"
Server: Apache/2.2.14 (Ubuntu)
Content-Length: 14187
Content-Type: image/gif
Expires: Tue, 03 Aug 2010 22:31:03 GMT
Last-Modified: Fri, 08 May 2009 20:46:23 GMT
Client-Date: Tue, 27 Jul 2010 22:31:02 GMT
Client-Peer: 127.217.30.5:80
Client-Response-Num: 1

Apache2 offers this feature through its mod_expires module. Note that this module is usually disabled by default, meaning your visitors would download all the files over again each time they change the page.

Read the rest of this entry »

――

User of stackoverflow or serverfault? Help us create one for Ubuntu!

Are you a user of stackoverflow or serverfault?
You will be interested in the fact that you can help create a site similar to those above but for Ubuntu!!!

Click here to participate and help to create a Q&A site for Ubuntu!

――

Name-Based Virtual Hosts with SSL using Apache2 on Ubuntu Lucid

It has now been a few years (2007) that SNI (Server Name Indication) has been introduced/supported in OpenSSL 0.9.8, but it has only been just last year that SNI was fully supported in Apache2 with version 2.2.12 released in July 2009. Now we can really having
multiple virtual hosts with different certificates on the same IP address! No need to buy any more IP addresses!

Read the rest of this entry »

――

How to backup MySQL users except root on Ubuntu

When you want to backup your mysql databases, you usually do mysqldump ... --all-databases or mysqldump ... --databases mysql ... but you end up with the whole mysql table which is a pain to insert back when you need it because it can mess up the root password or the debian-sys-maint user...

If you wish to just backup all the users and privileges other than root and debian-sys-maint, you can use this command:

mysqldump -nt -uroot -p -w"User NOT LIKE 'root' AND User NOT LIKE 'debian%'" mysql user db > users_privs.sql

Here's an explanation of each of the options:

  • -nt: Do not add "drop table" and "create table".
  • -uroot -p: Connect as root and ask for a password
  • -w...: Add a "WHERE" condition to each query. We exclude everything related to root and debian-sys-maint.
  • mysql user db: Dump the user and db tables from the mysql database.
  • > users_privs.sql: Store the sql dump into the users_privs.sql file.
――