Open a virtual shell with ctrl-alt-f1. Login and type "sudo service gdm stop" without the quotes. Then go to another console (ctrl-alt-f2), and type "sudo Xorg -configure". You can edit the file with your settings, take a look at
http://ubuntuforums.org/showthread.php?t=83973 or http://bit.ly/KZTwWT to see common options. When you are ready to use the new file, type "sudo mv ~/xorg.conf.new /etc/X11/xorg.conf" and "sudo service gdm start". Then go to the main console with ctrl-alt-f8.