Recovery after change in IP or hostname | Wordpress

If the wordpress site/blog is inaccessible following a change in the IP or the hostname, use the following option to reset the siteurl in the database manually.

mysql> update wp_options set option_value='<new ip/hostname>' where option_name='siteurl';

This might not always be the case, as you might not always have direct access to the database on the web host. Refer to Changing The Site URL to get this done in various restricted environments.

There might be a case where the site/blog is up and running but you end up being unable to access the admin portal (wp-admin). Add the following lines to your wp-config.php to regain access.

define('WP_HOME','<new ip/hostname>');
define('WP_SITEURL','<new ip/hostname>');

Optimal file permissions | Wordpress

When setting up a Wordpress site/blog, the web server may need access to the files. The following configuration for the file permissions could be optimal and resolve most of the issues related to file permissions.

One of the errors due to incorrect file permissions is show below. Wordpress doesn't have enough privileges to perform a plugin install.

sudo chown www-data:www-data -R *         # Let apache be owner
sudo find . -type d -exec chmod 755 {} \; # Set dir permissions rwxr-xr-x
sudo find . -type f -exec chmod 644 {} \; # Set file permissions rw-r--r--

After the setup it is better to tighten the access rights, according to Hardening WordPress all files except for wp-content should be writable by your user account only. wp-content must be writable by www-data too.