SETUP REMOTE MYSQL SERVER
Let ip address of mysql server is 192.168.33.12 and ip address of wordpress server is 192.168.33.11
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Add items shown below...
bind-address = 192.168.33.12
mysqlx-bind-address = 192.168.33.12
require_secure_transport=ON
# The following values assume you have at least 32M ram
[mysqld]
#
# * Basic Settings
#
user = mysql
# pid-file = /var/run/mysqld/mysqld.pid
# socket = /var/run/mysqld/mysqld.sock
# port = 3306
# datadir = /var/lib/mysql
# If MySQL is running as a replication slave, this should be
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 192.168.33.12
mysqlx-bind-address = 192.168.33.12
require_secure_transport=ON
#
# * Fine Tuning
#
key_buffer_size = 16M
# max_allowed_packet = 64M
# thread_stack = 256K
# thread_cache_size = -1
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
# max_connections = 151
# table_open_cache = 4000
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
#
# Log all queries
# Be aware that this log type is a performance killer.
# general_log_file = /var/log/mysql/query.log
# general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
sudo mysql_ssl_rsa_setup --uid=mysql
sudo systemctl restart mysql
sudo ufw allow mysql
CREATE LOCAL AND REMOTE USERS FOR WORDPRESS
sudo mysql -u root -p
mysql>CREATE DATABASE wordpress;
mysql>CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
mysql>GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
mysql>CREATE USER 'wordpressuser'@'192.168.33.11' IDENTIFIED BY 'password';
mysql>GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'192.168.33.11';
mysql>FLUSH PRIVILEGES;
mysql>exit
TEST LOCAL LOGIN
sudo mysql -u wordpressuser -p
exit
SETUP WORDPRESS
INSTALL APACHE2
sudo apt update
sudo apt install apache2
sudo nano /etc/apache2/apache2.conf
Add items shown below...
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
.
.
.
ServerName 192.168.33.11
sudo apache2ctl configtest
sudo systemctl resart apache2
INSTALL PHP
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
Add items shown below...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo nano /etc/apache2/sites-available/wordpress.conf
Add items shown below...
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wordpress/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
</VirtualHost>
sudo a2dissite 000-default.conf
sudo a2ensite wordpress.conf
sudo systemctl resart apache2
TEST REMOTE LOGIN
sudo apt update
sudo apt install mysql-client
sudo mysql -h 192.168.33.12 -u wordpressuser -p
status
vagrant@wordpress:~$ sudo mysql -h 192.168.33.12 -u wordpressuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> status
--------------
mysql Ver 8.0.28-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
Connection id: 28
Current database:
Current user: wordpressuser@192.168.33.11
SSL: Cipher in use is TLS_AES_256_GCM_SHA384
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)
Protocol version: 10
Connection: 192.168.33.12 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
TCP port: 3306
Binary data as: Hexadecimal
Uptime: 5 hours 52 min 13 sec
Threads: 2 Questions: 1380 Slow queries: 0 Opens: 310 Flush tables: 3 Open tables: 229 Queries per second avg: 0.065
--------------
mysql>
INSTALL WORDPRESS
sudo apt update
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
touch /tmp/wordpress/.htaccess
mkdir /tmp/wordpress/wp-content/upgrade
sudo cp -a /tmp/wordpress/. /var/www/wordpress
sudo chown -R www-data:www-data /var/www/wordpress
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;
curl -s https://api.wordpress.org/secret-key/1.1/salt/
sudo nano /var/www/wordpress/wp-config.php
Add items shown below...
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'wordpressuser' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password' );
/** MySQL hostname */
define( 'DB_HOST', '192.168.33.12' );
/** 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', '' );
/** Filesystem access **/
define('FS_METHOD', 'direct');
define('MYSQL_CLIENT_FLAGS',MYSQLI_CLIENT_SSL);
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'lHXIEBscvukaKTTKemdxTKwqkZAYKcdsBEDZOdfKoiIcHNitDUsaQVXSRFOCGUeN' );
define( 'SECURE_AUTH_KEY', 'glMCvJuNNbxTGHrWEvoaQJRrXQmuitCQzlrrSWGIGqnAGaNKrEGfdrjLbRLLpzyP' );
define( 'LOGGED_IN_KEY', 'WSNYFtIyhbbxVeUrknxSTeCoYwAITwPzLWHaisDYbDzNzQhchwzYWGXCtYqzZHea' );
define( 'NONCE_KEY', 'LNafVmEUrzdbNUNBBFetYVNVrNdQJtHrAMCvnuuhYUOfdJKSojdwhcaDRWEwNEGe' );
define( 'AUTH_SALT', 'clrZnisVDDPhghcRuzkikwYwbiOCDhUNvBeGhRIqMiiNtLgzgyssayzRqhJcOjul' );
define( 'SECURE_AUTH_SALT', 'iEkqmyBdqOlAwrtXDbruTKRovMCivItXxMlzQloxtnnSaPVOyJhKongOkQprucbH' );
define( 'LOGGED_IN_SALT', 'yaxUyvcmiLfyaPgkHtQxGDwVrltghUWuEOTFpshKJnvmcjUREnmNanZcGhIlymTc' );
define( 'NONCE_SALT', 'OLZbpiWfkPafzCybIldkrqvswjNhVrVihbnRLFOvPHcrETpdKFftzWsGHBkIAKcG' );
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
In your web browser, navigate to your server’s domain name or public IP address:
Top comments (0)