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.

Continue reading “How to set up Expires header with Apache2 on Ubuntu Lucid 10.04”

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!

Continue reading “Name-Based Virtual Hosts with SSL using Apache2 on Ubuntu Lucid”

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.

Things to remember to backup or copy when migrating servers

A new version of your operating system just got released and you want to have a fresh new install, or you want to migrate all of your data to another machine. There are so much stuff to backup that you don’t even know where to start?
I will try to list the most common stuff (on a web-server) to backup or copy somewhere when you want to do a server migration.

Continue reading “Things to remember to backup or copy when migrating servers”

How to enable VNC (Vino) on Ubuntu (Gnome)

The way I’m going to describe is using the GDM autologin which can be UNSECURE if someone has physical access to the machine.

Activate autologin in gdm by editing /etc/gdm/custom.conf and add:

AutomaticLoginEnable=true
AutomaticLogin=yourusername

Reboot.

Then ssh as yourusername into the machine, and type this:

DISPLAY=:0.0
gconftool-2 --type list --list-type string --set /desktop/gnome/remote_access/authentication_methods '[vnc]'
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false
vino-passwd
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

Reboot.

Then try connecting to your machine using VNC.

Source: By Weboide in How do i install gnome on Debian and remote to it? [serverfault.com]
This post is Licensed under CC-BY-SA 2.5