For configuring your first WordPress
application, configure an apache site.
Open /etc/apache2/sites-available/wordpress.conf and write the
following lines:
Alias /blog /usr/share/wordpress
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all
Options FollowSymLinks
Order allow,deny
Allow from all
Enable this new WordPress site
Once you configure the apache2 web server and
make it ready for your WordPress
application, you should restart it. You
can run the following command to restart the
apache2 web server:
sudo systemctl restart apache2.service
To facilitate multiple WordPress installations, the name of this
configuration file is based on the Host header of the HTTP request.
This means that you can have a configuration per VirtualHost by simply
matching the hostname portion of this configuration with your Apache
Virtual Host. e.g. /etc/wordpress/config-10.211.55.50.php,
/etc/wordpress/config-hostalias1.php, etc. These instructions assume
you can access Apache via the localhost hostname (perhaps by using an
ssh tunnel) if not, replace /etc/wordpress/config-localhost.php with
/etc/wordpress/config-NAME_OF_YOUR_VIRTUAL_HOST.php.
Once the configuration file is written, it is up to you to choose a
convention for username and password to mysql for each
WordPress
database instance. This documentation shows only one, localhost,
example.
Now configure WordPress to use a mysql database.
Open /etc/wordpress/config-localhost.php file and write
the following lines:
Now create this mysql database. Open a temporary file with mysql commands
wordpress.sql and write the following lines:
CREATE DATABASE wordpress;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
ON wordpress.*
TO wordpress@localhost
IDENTIFIED BY 'yourpasswordhere';
FLUSH PRIVILEGES;
Execute these commands.
cat wordpress.sql | sudo mysql --defaults-extra-file=/etc/mysql/debian.cnf
Note the generated password (if applicable) and click the login password. Your
WordPress is now ready for use.