Installing wordpress over ssh on the ghost ami digital-ocean droplet.

Connect to droplet over SSH:

ssh -i /path/to/certificate user@server.name

Create working directory at var/www:

cd /var/www
mkdir your-site
cd your-site

Install wordpress by downloading and unpacking it:

wget https://wordpress.org/latest.tar.gz
tar xf latest.tar.gz
mv wordpress/* .
rm -r wordpress latest.tar.gz

Setting new nginx route:

cd /etc/nginx/sites-available/
touch your-site.conf

Edit the your-site.conf file to have such content:

Note to type right version of PHP fpm you use installed.

server {
    listen 80;
    listen [::]:80;

    server_name your-site.com;
    root /var/www/your-site;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }

    client_max_body_size 50m;
}

Now if you go to your site you see 403 Forbidden error message you have to install PHP.

sudo apt-get install php-fpm php-mysql

Test nginx configuration

sudo nginx -t

Reload nginx server

sudo systemctl reload nginx

Ok, now you should be able to see wordpress setup:

Login to mysql

mysql -u USER -pPASS

Create database

create database mysitewp;

Create user

create user 'site-wp'@'localhost' identified by 'password';

Grant database to this user

grant all privileges on mysitewp.* to 'site-wp'@'localhost';

Leave mysql console

exit

Now this db credentials may be used to finish visual installation.