I ended up having to install the server 3 times. This was mainly do to user error and from trying to force it to use https. I tried both NGINX and Apache and stuck with Apache.
After changing the permalinks I was getting 404 errors. The site status was saying the the was an issue with the rest API. Everything I could find just mentioned the .htaccess file and to make sure it was being updated. Nothing was working until I finally found a post mentioning the apache2.conf that needed to be edited.
https://wordpress.org/support/topic/permalinks-change-breaks-all-links/
Below is the commands that I used to install WordPress and to enable HTTPS. Anything bold needs to be changed.
sudo -s
apt install apache2 -y
#check if working by going to http://your_server_ip
apt install mariadb-server mariadb-client -y
mysql_secure_installation
apt install php php-mysql -y
mysql -u root -p
CREATE DATABASE wordpress_db;
CREATE USER'wp_user'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL ON wordpress_db.* TO 'wp_user'@'localhost' IDENTIFIED BY 'Password';
FLUSH PRIVILEGES;
Exit;
cd /tmp && wget https://wordpress.org/latest.tar.gz
tar -xvf latest.tar.gz
cp -R wordpress /var/www/
mv /var/www/wordpress /var/www/Domain
mkdir /var/www/Domain/wp-content/uploads
chown -R www-data:www-data /var/www/Domain/wp-content/uploads/
chown -R $USER:$USER /var/www/Domain/
nano /etc/apache2/sites-available/Domain.conf
chown -R www-data:www-data /var/www/Domain/
chmod -R 755 /var/www/Domain/
a2ensite Domain
a2dissite 000-default
apache2ctl configtest
systemctl reload apache2
apt install certbot python3-certbot-apache
certbot --apache
You will enter the following the newly created file.
<VirtualHost *:80>
ServerName Domain.com
ServerAlias www.Domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/Domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>