(This is an updated version of Clearfire's tutorial, which is excellent, but has become slightly outdated as Digital Ocean updates their applications.)
-
Create your droplet. Name it, select your size and location, then hit the Applications tab and select (as of this writing) "LAMP on 14.04". Add your SSH key if you want, and submit.
-
SSH into your new droplet, and maybe check to make sure the following PHP modules have been installed: (In my recent experience, these have all been installed automatically, but that could change, and it takes 10 seconds to check.)
apt-get install php5-gd
apt-get install php5-mysql
apt-get install php5-curl
-
Make sure mod_rewrite is enabled, with
a2enmod rewrite
. -
If you like, increase PHP's
upload_max_filesize
andpost_max_filesize
values by editing the php.ini file, with this:nano /etc/php5/apache2/php.ini
-
Give Apache a restart:
service apache2 restart
-
Change the MySQL root password:
mysqladmin -u root -p'[FOO]' password newpassword
(The initial password is displayed in the terminal when you first SSH into the new server. Look for "Your MySQL root user's password is [FOO]".) -
Log in to MySQL:
mysql -u root -p
(It will prompt you for your new password.) Note: Sometimes this fails, and you need to manually reset the root password. These instructions have worked. -
Create a new user, so we aren't using root all the time:
CREATE USER [NEW USERNAME]@'%' IDENTIFIED BY '[NEW PASSWORD]';
-
Grant the new user full access:
GRANT ALL PRIVILEGES ON * . * TO '[NEW USERNAME]'@'%';
-
FLUSH PRIVILEGES;
and exit out of MySQL. -
If you want to allow remote connections (and during development, I certainly do), edit the MySQL config file:
/etc/mysql/my.cnf
, commenting out the linebind-address 127.0.0.1
. -
Restart MySQL:
service mysql restart
-
Make sure .htaccess is enabled for rewrites. Edit this Apache config file:
sudo nano /etc/apache2/sites-available/000-default.conf
(In my limited experience, this file name is subject to change as new versions of Ubuntu are realeased, so if Nano opens an empty file, that ain't it.) -
Add this directory statement:
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
-
Voila! Your web root is at
/var/www
.