How to make a new wordpress site

This tutorial assumes you know how to ssh into your server and that your server is running Ubuntu, Apache2, WordPress stack.

First go to your www/ folder where all your wordpress sites live.

cd /var/www/

download wordpress, unzip, and rename the unzipped folder to your new site name

wget wordpress.org/latest.zip
unzip latest.zip
mv wordpress newsite.com

Now we need to change the owner of this new folder from root to the user wordpress uses

chown -R www-data:www-data newsite.com/

Go to apache’s site config files

cd /etc/apache2/sites-available

Copy an old config to start your new one

cp oldsite.com.conf newsite.com.conf

Change all the old site data to the new site data in the conf

vim newsite.com.conf

Tell apache you want to enable a site and follow the instructions to enable your new site

a2ensite

Reload apache for the changes to take effect

systemctl reload apache2

We are almost there! We just need to get some SSL certificates for our site so people can access it using https. The following command will start certbot – an certification wizard that will help you get those certs! Just follow the instructions as they appear. Make sure you select both www and non-www versions to certify.

certbot

Now we need to create the database for our site, which will have all the posts and images and all sorts of other data. We will enter mysql to start being able to enter sql commands to create our database and user. Please replace wp_site, wordpressusername, and password with your own!

mysql

CREATE DATABASE wp_site;
CREATE USER "wordpressusername"@"%" IDENTIFIED BY "password";
GRANT ALL PRIVILEGES ON wp_site.* to 'wordpressusername'@'%' WITH GRANT OPTION;

Now you are finished creating your site in your server! Hop onto your internet browser and navigate to your new site.

You should be greeted with the wordpress installation. For Database Name, Username, and Password – enter the info you had just created earlier. For Database Host and Table Prefix, leave as is.

Just follow the wordpress wizard to completion and you’ll have a new site!