Oct 29, 2018

Installing Statamic on Digital ocean Ubuntu 16.04

More of a memo to myself than a tutorial, but after countless changes of server I find myself always searching for clear tutorial each time so I have decided to create one that suits my needs. Maybe it will be helpfull to others.

  1. follow this tutorial on how to set up your droplet initial set up I stopped at step 4 and did not install a Public Key
  2. Then I went the usual way installing Apache2
sudo apt-get update
sudo apt-get install apache2
  1. You then need to install PHP
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

and then run this :

sudo systemctl restart apache2.service
  1. Find this site.conf file here
sudo nano /etc/apache2/sites-available/000-default.conf

and apply those changes to it replacing Example.com with your own URL

<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/html/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
  1. Enable the rewrite module
sudo a2ensite 000-default.conf
sudo a2enmod rewrite

and restart apache see above. 6. Grant correct permission to the USER

usermod -a -G www-data USER
chown -R USER:www-data /var/www/html
  1. Use letsencrypt to secure your serve and serve your website through HTTPS I used the tutorial from Digital Ocean here
  2. Don't forget to change the apache2 conf file to serve PHP first
sudo nano /etc/apache2/mods-enabled/dir.conf

and have it display like that with index.php first :

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

and few more details here for LAMP set up 9. That sould be it for the server aspect of things now you should just follow the Statamic Install tutorial on statamic.

Note not to forget to change the files permissions and to upload the sample.htaccess file and rename it to .htaccess.

Enjoy