This is the first post 2019-12-10 since the nightmare of installing WordPress on a fresh version of Ubuntu Server 19.10.
So you have installed the latest version of Ubuntu Server on your cheap NUC, done some port forwarding and you’re all LAMPed up. The WordPress guide at Ubuntu will mess you up, lead you away from solutions. Google will help. The wordpress forum has some good information buried deep, as does stack exchange. It is all simple, but esoteric, hard to find. There are well intentioned postings that want you to do very bad things, so be careful picking and choosing.
# su is naughty, so either you will use it, or you prefix sudo to all cmds
su
### LAMP
apt install lamp-server^
# Now fiddle with PHP.ini
nano /etc/php/7.3/apache2/php.ini
# Now fiddle with MySQL.cnf
nano /etc/mysql/mysql.conf.d/mysqld.cnf
# restart all the things
systemctl restart apache2
systemctl restart mysql
### WordPress
apt install wordpress
# /var/lib/wordpress/
# /usr/share/wordpress/
# Edit the wordpress site file
# This places wordpress in a virtual folder off your site. /blog
nano /etc/apache2/sites-available/wordpress.conf
#--- File: /etc/apache2/sites-available/wordpress.conf
Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
<Directory /usr/share/wordpress/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
#--- END File: /etc/apache2/sites-available/wordpress.conf
# Enable the site
sudo a2ensite wordpress
systemctl reload apache2
# WordPress config file
cp /usr/share/wordpress/wp-config-sample.php /etc/wordpress/config-default.php
nano /etc/wordpress/config-default.php
#--- File: /etc/wordpress/config-default.php
# Edit all the settings you can with your setup details.
# Assuming your username and database are wordpress (see SQL below)
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'wordpress' );
/** MySQL database password */
define( 'DB_PASSWORD', 'yourpasswordhere' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/** Trying to avoid stupid FTP */
define( 'FS_METHOD', 'direct' );
#--- END File: /etc/wordpress/config-default.php
# Permissions for wordpress to import files, themes, etc
# You may have to add root to the www-data group
chown root:www-data -R /usr/share/wordpress/wp-content
chmod -R 775 /usr/share/wordpress/wp-content
# Prep SQL
mysql -u root
#--- MySQL commands
CREATE USER wordpress@localhost IDENTIFIED BY 'yourpasswordhere';
ALTER USER 'wordpress'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpasswordhere';
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost;
QUIT;
#--- END MySQL
# The remainder of the setup happens within WordPress
http://your.blog.domain/blog