WordPress

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
systemctl status apache2

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'User'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL ON wordpress_db.* TO '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
add the following

<VirtualHost *.80>
        ServerName Domain
        ServerAlias www.Domain
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/Domain
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

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

Scroll to Top