Installing Wordpress on virtualhost

welcome to the world of container, you cannot use localhost here, localhost is not good, a container is like another VM somewhere, use the IP and also please take into account that your user of mariadb cannot be be restricted to localhost, use ``

 migrate web data and mariadb mysql database to ns8



https://www.comparitech.com/net-admin/sftp-commands-cheat-sheet/



how to create a user inside mariadb container, first on the node ssh to the userLinux

# connect to mariadb1 (module_id)
ssh mariadb1@localhost
# connect to the mysql container as root
podman exec -ti mariadb-app mysql
# create the database and grant user to all from any IP (external port is closed to 127.0.0.1)
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS mydatabase;
MariaDB [(none)]> grant all privileges on mydatabase.* to username identified by 'password';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
add data to the database from a mysql dump
podman exec -i mariadb-app mysql < toto.sql

the example content of toto.mysql, like you can see the user is able to connect from any host, this is a mandatory because we connect from outside the container, but the tcp port random is restricted to localhost

 CREATE DATABASE if not exists foo;
CREATE USER if not exists 'foo' IDENTIFIED BY "foo";
GRANT ALL PRIVILEGES ON foo.* TO 'foo';
FLUSH PRIVILEGES;

use foo;
CREATE TABLE IF NOT EXISTS pages (
  id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(30),
  content TEXT,
  INDEX(title)
) engine=InnoDB;

INSERT IGNORE INTO pages VALUES (1, 'Bienvenue', 'Bienvenue ');
then on the remote host running the web server send all local files by scp (login 9001 password 9001 for the first vhost you have created inside the ns8-webserver )

the default port is tcp 3092, think to enable the external access, the 9001 is the login of the first vhost

sftp -P 3092 9001@r1.rocky9.org
# move to you local web folder and cp everything to the vhost of NS8
lcd Téléchargements/wordpress-6.2.2-fr_FR/wordpress/
sftp> put -r *
4 Likes