Dreamhost dream deal: hosting for $1.60 per month

If you ever wanted to try out a new hosting company or if you need a cheap hosting account for a side project, this is your chance.

Dreamhost is turning 16 and to celebrate this event they´ve launched a few great offers. The one that caught our eye was the Sweet 16 hosting offer: this deal includes a year of Dreamhost shared hosting for only $1.60 per month (normal price: $8.95).

That´s less then $20 for a full year of web hosting – including a free domain name.

Actually, two domain names. Part of the offer is that you get to choose a free second domain name on the .co TLD. It´s a nice little extra, but keep in mind that .co renewals are not cheap. The regular fee at Dreamhost is $26.99 per year.

To benefit from this offer go to http://www.dreamhost.com/sweet16/ (valid untill 22/9)

Easily add a domain alias to Google Apps (without the sent via)

The domain alias feature of Google Apps for domains allows you to manage different email adresses from one single inbox. It´s easy to set up and makes managing multiple accounts so much more effective.

One issue that often comes up though, is that your primary domain is shown next to the domain alias in the emails from-field:

From: user@domainalias.com via primarydomain.com

Luckily it´s quite easy to get rid of the via link by adding authenticating keys to your email headers. Follow the steps below to set up domain aliases without the vialink.

  1. Add domain alias – Follow these instructions to add the domain alias to your account.
  2. Set MX records – Configure the MX records of your domain. Detailed instructions here.
  3. Add authentication records – To prevent Gmail from showing your primary domain, you need to set up SPF and DKIM email authentication headers.
  4. Wait for propagation – It may take a while before your DNS records are updated on all servers. I nmy case it took about 30 minutes. Use Google Apps Toolbox to check for any issues.
  5. Verify domain alias to primary email account – Login to your primary email account and configure it for sending mail from your domain alias. Use the username of your primary domain (eg if you´re username is info@primarydomain you should now use info@secondarydomain.com). Important: select the option Send through domainalias.com SMTP servers. Set smtp.gmail.com as SMTP server and select port 465. Use your primary domain´s username and password.

Install WP MultiSite with Top Level Domains

In this brief turorial we´ll install WordPress Multisite and give each site in the network it´s own separate top level domain.

Changing the DNS settings

First we need to point all the domains we want to use in this network to our WordPress Multisite install. This usually involves two steps:

  1. Specify the IP address of your server for each domain
  2. Let your server know it should pass on incoming requests for your domains to your WordPress Multisite install.

In practice this usually means changing the A-records of your domains and point them to your server.

Pick one domain as your primary domain and add it to the server. For the other ones you can create virtual hosts under this primary domain.

In DirectAdmin you would first add a new domain and then go to Admin level > Custom HTTPD Configurations and select your primary domain. You can now add the virtual hosts:

ServerAlias secondarydomain.com www.secondarydomain.com

Install WordPress Multisite

Install WordPress and follow the instructions on how to enable WordPress Multisite.

When asked if you want to use subdomains or subdirectories choose subdomains.

If you installed your primary domain using the www-prefix, a warning will appear when you enable Multisite: We recommend you change your siteurl to example.com before enabling the network feature. Personally I always ignore this warning and have never experienced any problems.

Map your domains

When WordPress Multisite is up and running you can start adding new sites. By default they will use a subdomain like subdomain.example.com. To change this to a top level domain, choose Edit site as Network Admin and specify the domain name you want to use on the info tab.

Also add one more line to your wp-config.php file: define('COOKIE_DOMAIN', '');

To www or not www

If you´re prepending your domains with the www subdomain, you´ll want to redirect the non-www versions of your domain to the www versions. On a single install WordPress takes care of this, but in a Multisite environment I´ve always had to do this manually.

For each domain you´re using, add the below redirect in your .htaccess file (changing example.com to your domain):

RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

You should now have a Multisite install with seperate domain names.

Install WordPress quickly using SSH

Installing WordPress via FTP can take up quite a long time, as you´ll have to upload hundreds of files to the server. Installing via the console is much faster, but you really need to know what you´re doing.

Personally I´m using a hybrid install process, using the control panel and command prompt. I found this to be the easiest way to get up and running quickly.

Below are the steps I take when I need to do a complete WordPress install from scratch. I´m using a Debian Squeeze based VPS with the DirectAdmin control panel. FTP is completely disabled on this machine.

Create a database

I start with creating the database and user in my DirectAdmin control panel. Other control panels like Cpanel or phpMyAdmin can also do this job.

Download WordPress

Using the shell to download and install WordPress is a real timesaver. As I´m on a Windows machine I use Putty to login to my server over SSH.

Browse to the directory where you want to install WordPress and execute the following commands:

  1. Download and unpack the latest WordPress package:
    wget http://wordpress.org/latest.tar.gz && tar xfz latest.tar.gz
  2. Move the contents of the WordPress folder one level up:
    mv wordpress/* ./
  3. Delete the empty WordPress directory and the compressed package:
    rmdir ./wordpress/ && rm -f latest.tar.gz

Edit wp-config.php

You could do this using a console editor like Nano or Vi but as it involves quite a few steps I prefer to do it on the desktop. Download wp-config-sample.php from the server, rename it to wp-config.php and open it in your favorite text editor and:

  1. Add your database name, user and password
  2. Add the authentication keys and salts
  3. Change the WordPress database table prefix (optional)

I also disable WordPress post revisions and set the autosave interval to a really high number by adding these two constants just above the line /* That’s all, stop editing! Happy blogging. */:

  1. define('AUTOSAVE_INTERVAL', 35000);
  2. define( 'WP_POST_REVISIONS', false );

When done, upload the wp-config.php file to the server. WordPress allows you to save the file one level above your WordPress install. This is usually one level above the public_html directory (unless you´re installing WordPress in a subdirectory of your site).

Change the owner/group

One of the major drawbacks of installing WordPress via SSH is that all files are now owned by the user who uploaded the files. This means you won´t be able to use WordPress auto update features.

To get auto update to work we need to change the owner or group to the user Apache runs under. How to do this depends on your OS and server configuration. I use the below command as root:

chgrp -R apache public_html

but Apache might use a different name on your server (www-data or nobody are common names).

Run the install script

Install WordPress by running the script at http://example.com/wp-admin/install.php.

Enable WordPress SSH updates

To allow WordPress auto updates over SSH/SFTP I need to install one additional plugin: the brilliant SSH SFTP Updater Support

Using the same shell commands as above, this will only take a minute. Browse to the plugins folder and execute the following commands (update the plugin version number if a newer versions is available):

  1. wget http://downloads.wordpress.org/plugin/ssh-sftp-updater-support.0.4.zip
  2. unzip ssh-sftp-updater-support.0.4.zip
  3. rm -f ssh-sftp-updater-support.0.4.zip
  4. chgrp -R apache plugins (note: execute this command as the root user!)

Also note that the unzip command requieres the package with the same name in Debian Squeeze.

That´s all!

Create unique domain names using Virtual Hosts

If you´ve installed WordPress locally, you´ll usually access you´re projects via the localhost. For example http://localhost/wordpress or if you´re using WordPress MultiSite http://localhost/wordpress/project/.

This works fine, but it would be even better if we could use an specific domain name for each project. That way we could access our local WordPress installs via http://wordpress.dev or any other name of your choice.

Luckily that´s quite easy to set up by creating Virtual Hosts in Apache.

To set up Virtual Hosts and start using your own unique domain names, follow this detailed tutorial: How to Set Up Virtual Hosts Using WAMP.

How to edit the host file in Windows 7

To use Virtual Hosts, you´ll need to edit the Windows host file. On Windows 7, editing the host file requieres a few extra steps.

  1. Open the folder Start > All Programs > Accessories
  2. Right click on the Notepad entry and select Run as administrator
  3. In Notepad, choose File > Open and select All Files (*.*) from the dropdown menu in the dialog box
  4. Browse to the directory C:WindowsSystem32driversetc and open the hosts file
  5. Edit and save the file

That´s not all. You´ll see that Windows 7 saved the file as a text file (.txt), even if we choose to save it without the text extension. Let´s change that.

  1. Make sure you´re still in the C:WindowsSystem32driversetc directory
  2. Press the alt key
  3. In the top menu, select Tools > Folder Options > View and untick the box Hide extensions for known filetypes
  4. Rename the hosts.txt file to hosts without the extension

Tips, tricks and troubleshooting

  • Remember to update the WordPress Address and Site Address in the Settings panel, if you already installed a WordPress site locally
  • If you get this error message: “You don’t have permission to access / on this server” – this solution might work

Install WordPress locally using WampServer (WAMP) – Part 2

In the first part of this tutorial on how to install WordPress locally we downloaded and installed WampServer. In this second part we´ll complete our local set up by creating a database and installing WordPress.

If you´ve read our previous guide on installing WordPress this process should be pretty familar.

Create a MySQL database and user

We´ll use phpMyAdmin to create our database and user. You can access phpMyAdmin anytime when WampServer is running via http://localhost/phpmyadmin/ or by clicking the phpMyAdmin link on the WampServer welcome screen at http://localhost/

Important: don´t copy the database name and username from this article. Use your own secure names instead. If you already installed WordPress on a live server, we recommend you to use the same database name and user for yor local instance.

In phpMyAdmin, select the Databases tab in the top menu, write your database name in the input field and hit the Create button.

Create Database in phpMyAdmin

Your new database will now show up in the list of available databases. Click on the name of your database. This will open your database settings panel.

Add user in phpMyAdmin

Select the Priviliges tab from the top menu and click on the Add user on the bottom of the page. A form will pop up with three fields:

  1. Login information
    Fill in a username and strong password. Copy these details, you´ll need them in a minute. Set the host field to local.Add user in phpMyAdmin - Login info
  2. Database for user
    Verify that your newly created database is selected.Add user in phpMyAdmin - database info
  3. Global priviliges
    Don´t select any Global priviliges – our user only needs access to the WordPress database.Add user in phpMyAdmin - Global privileges

When done, click Add user.

Install WordPress

On a live webserver, websites usually have their own public_html directory where all website files and scripts are located.

If you´re hosting your WordPress site on a shared server, you´ll only get access to the public_html folder of your own website. However, with WampServer we have a complete server at our disposal. We can create as many websites as we want and install as many instances of WordPress as necessary.

In a WampServer envireonment, each site is called a project. Creating a project is as simple as creating a new directory in the www folder. By default the directory is located in C:wampwww

Browse to the www-folder and create a new directory using the name of your website.

Download WordPress and place all files in your newly created folder. The result will look like this:

WampServer directory structure

Open http://localhost/my_website/ in your browser (replace /my_website/ with the name of the folder you created). WordPress will ask you if you want to create a configuration file. That sounds like a good idea. Click the Create a Configuration File button.

On the new screen, you´ll be asked to enter your database name, username and password. Also change the wp_ prefix. When done, click Submit and Run the install on the next screen.

WordPress installation panel

The next screen should look familar: you´ve now installed WordPress on your local computer. Fill in your site details and don´t forget to change the admin username.

When done, you can find your new WordPress site at http://localhost/my_website/

Install WordPress locally using WampServer (WAMP)

Installing WordPress on your local pc allows you to make changes to your theme and test new plugins before implementing these on your live website. A local installation is also ideal to test new versions of WordPress – making sure nothing breaks – before updating on the server.

This tutorial is split up in two parts:

  1. Installing WampServer on our local computer
  2. Installing WordPress on our local computer

in this post we´ll install the software environment that WordPress needs to run (server, Apache, MySQL and PHP). In the second part we´ll actually install WordPress on our local computer.

A bit of background for beginners

WordPress was built to be run on a server, not on a pc. To install the platform locally we first need to create a server environment on our computer. Luckily, this is very easy.

WordPress needs Apache (or another HTTP Server), MySQL and PHP to run. This is a pretty standard configuration for servers. On Linux servers this environment is often called a LAMP-stack (Linux Apache MySQL PHP). On Windows it´s called WAMP and on a Mac MAMP.

Several companies and organizations have created WAMP stacks. XAMPP, EasyPHP and WampServer are among the most used. For a full comparison, have a look on Wikpedia.

In this tutorial we´ll install WampServer on a laptop computer running Windows 7.

Download WampServer

Head over to the download section on the WampServer website.

WampServer download page

Choose the right version to download based on the following criteria:

  • WampServer has versions for Windows 32 bits and Windows 64 bits. Read this article if you´re not sure which version of Windows you´re running. Choose the corresponding version of WampServer.
  • Choose the PHP version you wish to install. You´re free to choose any version that WordPress supports (check here). Ideally you´d use the same version as you´re WordPress hosting provider is using.

Download the version you want to install.

In the pop up dialog box, WampServer will notify you of any additional software that you need to install, like Visual C++. Make sure to install these packages first before proceeding.

Install WampServer

Doubleclick the icon and walk through the simple setup wizard. In most cases the default settings are fine. Also note that you can always change these settings later. I usually only change the default browser from Internet Explorer to Firefox or Chrome. Here´s a list of all steps:

  1. Accept the license agreementInstalling WampServer locally
  2. Select a location where you want to install WAMPInstalling WampServer locally
  3. Check the boxes if you want to add shortcutsInstalling WampServer locally
  4. Click the Install buttonInstalling WampServer locally
  5. Select your default browser. Common locations:
    • Internet Explorer:
      C:/Program Files/Internet Explorer/iexplore.exe
    • Firefox:
      C:/Program Files/Mozilla Firefox/firefox.exe
    • Google Chrome:
      C:/Documents and Settings/username/Local Settings/Application Data/Google/Chrome/Application/chrome.exe
  6. Set the PHP mail parameters

The installation usually takes less then a minute.

If you see the following error message during the install: MSVCR100.dll was not found mak sure you´ve installed Microsoft Visual C++ 2010 Redistributable Package.

Running your WampServer for the first time

Run WampServer

Go to Start > All Programs > WampServer and click Start WampServer

If everything went well, you´ll now see a small green icon in the lower right corner of your screen. This means all services are up and running.

If you see an orange or red icon, WampServer has not been able to start all services.

A common problem is that the port WampServer uses is already in use by another program. Skype, in most cases. If you have Skype installed on your computer, make sure it doesn´t use port 80:

  1. Open Skype
  2. Go to Tools > Options
  3. Select the Advanced tab and then the submenu Connection
  4. Untick the box that says Use port 80 and 443 as alternatives for incoming connectionsInstalling WampServer locally
  5. Restart Skype

Also make sure your FireWall is not blocking WampServer.

As soon as the light is green, open your browser and navigate to http://localhost. (An alternative way to do this is by clicking your left mouse button on the WampServer icon and selecting the Localhost shortcut on top.) This should take you to the WampServer home screen.

WampServer

Updating PHP or other services with DirectAdmin Custombuild

If you´re hosting your WordPress sites on an unmanaged VPS, you´ll have to perform all system updates and upgrades yourself. The control panel DirectAdmin offers a handy tool that makes keeping your server packages updated a breeze.

The tool is called DirectAdmin Custombuild. This script package allows DirectAdmin users to install and upgrade services like Apache, PHP and MySQL from a central place. Here´s a good introduction to DirectAdmin Custombuild.

Before making any changes to your server, don´t forget to backup your data. The process described below works for us, but your server might be totally different. Know what you´re doing.

How to install Custombuild

During the installation of DirectAdmin you´ll be asked if you want to install Custombuild. If your VPS came with DirectAdmin already running, chances are that Custombuild is already installed.

Here´s the recipe to install Custombuild from scratch:

cd /usr/local/directadmin
wget http://files.directadmin.com/services/custombuild/1.1/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
./build

To install version 1.2 beta simply change the version number to 1.2

When done, you need to run this command for the first time:

./build all d

How configure Custombuild

You can specify the services and versions you wish to use in the options.conf file. All available options are listed here.

To see your current configuration, run this command:

./build options

How to update PHP or another service

  1. cd /usr/local/directadmin/custombuild

    – browse to the Custombuild directory

  2. ./build options

    – review your current settings

  3. nano options.conf

    – edit the options.conf file, save and exit

  4. ./build update_data

    – always run this command after opdating options.conf

  5. ./build versions

    – check for available updates

  6. ./build update_versions

    – install the updates

Don´t forget to restart Apache if not done automatically by the update script.

How to install WordPress

Installing WordPress can seem a daunting task for beginners, but it really isn´t all that difficult. This tutorial will guide you through the process of setting up your WordPress site in four quick and easy steps. By following this guide you´ll not only learn how to install WordPress on your server, but you´ll also understand a little bit more about how WordPress works. Let´s get started!

Tools of the trade

During the set up we´ll use a few tools. Some of these are probably already installed on your computer. Have a look and download what´s missing. This is what you need:

  • Text editor – We´ll use a simple text editor to make notes, temporarily save passwords and usernames and edit WordPress files. Don´t use MS Word for this, as this program adds all kinds of invisible markup to your text. We strongly recommend you to use Notepad++ if you´re on Windows. If you´re on a Mac, have a look at TextWrangler. Both programs are 100% free.
  • FTP Client – An FTP Client is a small prgram that allows you to upload files to your server. We recommend the free open source program FileZilla.
  • Server login details – You´re hosting provider probably sent you an email with all logind etails for your account. We´ll need the login details for the FTP server and the ones for the control panel (cPanel, Plesk or DirectAdmin for example).
  • Password Tools (Optional) – To prevent your blog from being hacked, secure passwords are essential. Don´t use dictionary words, not even combined with letters or numbers. Choose a random string of lettes, numbers and symbols instead. Here´s a password generator you can use. After installing WordPress, you´ll want to store your passwords in a save place. Lastpass is a useful browser plugin that will automatically log you in to the sites you want.

Step 1: Preparation

We´ll start with creating a new folder on our computer where we´ll save all notes, documents and folders that we´ll use during the installation process. I usually create the folder on my desktop and call it wordpress_install. When done, open your text editor and create a new document. Save this as passwords.txt in your newly created folder.

Head over to WordPress.org and download the latest release. When done, unzip the file and save it in the wordpress_install folder. You´ll end up with this:

When we´re finished, simply delete this folder, but don´t forget to store your passwords first!

Step 2: Create the WordPress database

Creating a WordPress database in DirectAdmin

If you´ve never worked with servers, you´re probably not familar with the concept of databases. Don´t worry, it´s really simple to understand. Just think of a database as an Excel spreadsheet, with rows and columns. Within the spreadsheets there are also different worksheets. A database is pretty much the same.

WordPress uses this database to save all your posts, pages, uploads and personal settings. For security reasons WordPress can´t create the database itself, so we´ll have to do it. When done we´ll give the username and password to WordPress.

Databases come in different colors and flavours. WordPress uses a MySQL database.

The general process for creating a WordPress database is pretty similar on different control panels, although the exact steps may be slightly different.

  1. Login to your control panel with the login details your hosting provider sent you
  2. Find the “Create a database” link (other possible names: MySQL Database Wizard or MySQL Manager.)
  3. Create a database
  4. Create a database user and password
  5. Add the user to the database

Copy the database name, user and password to the password.txt file.

Step 3: Edit wp-config.php

Now that our database is set up, we should pass the login details to WordPress. We´ll also configure some additional WordPress settings. Start by opening the file wp-config-sample.php that you´ll find in the WordPress folder.

  • Add your database name, database user and password on the following lines:
    • define('DB_NAME', 'your_databasename');
    • define('DB_USER', 'your_username');
    • define('DB_PASSWORD', 'yourpassword');
  • Go to the WordPress secret key service and replace the secret keys in the wp-config-sample.php file with the keys on this page.
  • In the config file, look up the entry
    $table_prefix  = 'wp_';

    Add a few random numbers and letters after the

    wp_

    prefix and end with an underscore. Example:

    $table_prefix  = 'wp_1a2b34_';

    (Do not copy this example!)

  • Close the wp-config-sample.php file and rename it to wp-config.php

Step 4: Upload and install WordPress

Now that we´ve created a database and provided WordPress with the login details, it´s time to upload all our WordPress files to our server.

  • Open FileZilla and connect to your server with the username and password your hosting provider sent you.
  • Copy all the contents of the wordpress folder to the public_html folder on your server (or if you want to install wordpress in a subdirectory copy them to that folder).
  • Go to http://www.example.com/wp-admin/install.php (replace example.com with your domain) and fill in the site title, username and password. For security reasons it´s better not to use the default “admin” username. Any alternative is fine. Generate a long, random password and note it down in your password.txt file