Craft on digital ocean Ubuntu: Craft can’t connect to the database with the credentials in craft/config/db.php I have been working locally on MAMP and now have deployed the site to Digital Ocean using this guide.
However I can't access the site. for page links I get the service unavailable error, and for the admin I get the 'Craft can’t connect to the database with the credentials in craft/config/db.php.' error. 
i have checked my database credentials many times and they match. 



return array(
    '*' =&gt; array(
        'tablePrefix' =&gt; 'craft'
    ),
    '000.00.000.00' =&gt; array(
        'server' =&gt; 'localhost',
        'user' =&gt; 'craftcms',
        'password' =&gt; '************',
        'database' =&gt; 'craft'
    ),
    'localhost' =&gt; array(
        'server' =&gt; 'localhost',
        'user' =&gt; 'root',
        'password' =&gt; '************',
        'database' =&gt; 'craftdev'
    ),
);


my general config settings are as follows:

return array(
    '*' =&gt; array(   
        //'siteUrl' =&gt; "//projectname:8888/html/",
        'environmentVariables' =&gt; array(
            'basePath' =&gt; '/users/toddpadwick/Sites/projectname/html/',
            'siteUrl'  =&gt; '//projectname:8888/html/',
        ),
        'testToEmailAddress' =&gt; 'email@email.com',
        // Default Week Start Day (0 = Sunday, 1 = Monday...)
        'defaultWeekStartDay' =&gt; 0,
        // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)
        'enableCsrfProtection' =&gt; true,
        // Whether "index.php" should be visible in URLs (true, false, "auto")
        'omitScriptNameInUrls' =&gt; 'auto',
        // Control Panel trigger word
        'cpTrigger' =&gt; 'admin',
        // Dev Mode (see https://craftcms.com/support/dev-mode)
        'devMode' =&gt; true,
    ),
    // Use IP address of your droplet below
    '000.00.000.00' =&gt; array(

        //'siteUrl' =&gt; 'http://000.00.000.00/',

        'environmentVariables' =&gt; array(
            'basePath' =&gt; '/var/www/html/',
            'siteUrl'  =&gt; 'http://000.00.000.00/',
        ),
        // Default Week Start Day (0 = Sunday, 1 = Monday...)
        'defaultWeekStartDay' =&gt; 0,
        // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)
        'enableCsrfProtection' =&gt; true,
        // Whether "index.php" should be visible in URLs (true, false, "auto")
        'omitScriptNameInUrls' =&gt; 'auto',
        // Control Panel trigger word
        'cpTrigger' =&gt; 'admin',
        // Dev Mode (see https://craftcms.com/support/dev-mode)
        'devMode' =&gt; false,
    )
);


Any help would be greatly appreciated!
Could you post your nginx/apache configuration?

In short the configuration array key is matched based on the server name (server_name in nginx, ServerName in Apache httpd iirc).

If you're using some sort of default configuration it might not have a server_name, or a bogus one.

Thus, if your configuration array is like this:

&lt;?php

return array(

  '1.2.3.4' =&gt; array(
    'someSetting' =&gt; 'foo'
  );
);


You should have a corresponding configuration in (nginx in this example):

server {
  listen 80;
  server_name 1.2.3.4;
  ....
}


If you have more than one host in server_name, Craft will match on the first.