A Tutorial To Build A Debian 11 Web Site Hosting Server Using Apache, BIND, Dovecot, MariaDb, PureFTPD and ISPConfig - Page: 7
By: Edward Kimmel
Page Quick Links
Configure ISPConfig to Host MyDomain.com and Then Install WordPress
Now itâs time to configure ISPConfig to host your first web site MyDomain.com. After we get ISPConfig set up we will install WordPress, a popular âContent Management Systemâ.
WordPress is a content management system (CMS) that allows you to host and build websites. WordPress contains plugin architecture and a template system, so you can customize any website to fit your business, blog, portfolio, or online store.
I will also show you how to edit the âhostsâ file of a Windows PC so it can be used to test your server before you take your server live on the internet.
6.02 Create An ISPConfig Client
Once logged into ISPConfig, from the Home Page click Client -> Add New Client. You are now at the Client entry form. I advise to create a new client for every web site you add to your server.
Enter in at least the minimum required fields and enter your domain name as the Company name:
Click âSaveâ when completed. Your client should now appear in the list:
6.03 Create An ISPConfig Website
Now we will create the web domain MyDomain.com. Click Sites -> Add new website and you should see this page:
Fill in the web site web form and select the scripting services you want the web site to have:
Once you have your web site information set, click âSaveâ and you should see your web sit appear in the list:
6.04 Create An ISPConfig FTP Login
Now we need to create a FTP login for your web site files. In the Websites menu click on FTP Accounts -> Add new FTP-User and youâll see this screen:
Select The Website (mydomain.com), enter a suffix to the user name (_ftp) and enter a strong password (Client14Me2@ccessU).
Enter your FTP account information, then click âSaveâ and you should see your FTP account in the list:
6.05 Windows PC Hosts File â Optional
If you want to get your Debian 11 web site hosting server set up and fully tested on your local network before you give it internet access you may need to trick a Windowsâ˘ PC by editing the âhostsâ file. Using a text editor (Notepad) open âC:\Windows\System32\drivers\etc\hostsâ and add a few lines to make it look something like this:
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 18.104.22.168 rhino.acme.com # source server # 22.214.171.124 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 192.168.0.150 www.mydomain.com 192.168.0.150 mydomain.com
Save and close the hosts file, then reboot the Windowsâ˘ PC. Open a browser and type âmydomain.comâ as the URL and hit enter, you should see the ISPConfig web site default home page:
You can also open a browser on your Debian 11 computer and enter âmydomain.comâ to view your web site. This will work if you edited the hosts file in step 0.08. Now we will install WordPress, a content management system.
6.06 Create A WordPress MariaDb Database And User
Before we install WordPress we need to create a MariaDb database and user for WordPress. If you are going to host multiple web sites on this server which each will use WordPress I recommend using a separate database for each web site. I will use names familiar to the 1st web site we created.
First we need to get logged into MariaDb as root:
mysql -u root -p
Enter the MariaDB root password on request.
In the MariaDB shell, create a new database for WordPress:
MariaDB [(none)]> CREATE DATABASE WP1;
Then create a new user:
MariaDB [(none)]> CREATE USER 'client1'@'localhost' IDENTIFIED BY 'Client14Me2AccessU';
Replace the password âClient14Me2AccessUâ with a secure password of your choice in the commands above and below, use the same password both times. Then grant the user access to this database and reload database permissions.
MariaDB [(none)]> GRANT ALL PRIVILEGES ON WP1.* TO ‘client1’@’localhost’ IDENTIFIED BY ‘Client14Me2AccessU’ WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
6.07 Download Latest Version Of WordPress
Now we need to do is download the latest version of WordPress. Weâll change to the /tmp directory and then download a WordPress zip file with these commands:
cd /tmp wget https://wordpress.org/latest.zip wget https://codex.wordpress.org/Version_5.9
WordPress package comes as a Zip file. You need to unzip the file and inside it, you will find a WordPress folder. This folder contains all the WordPress files you need to copy to your ISPConfig MyDomain.com web site folder (/var/www/clients/client1/web1/web).
unzip latest.zip unzip Version_5.9
Once the files have been extracted, copy them into the client 1 web 1 root folder located at /var/www/clients/client1/web1/web. Use this command to copy the files from the wordpress directory to the MyDomain.com web directory:
cp -a wordpress/. /var/www/clients/client1/web1/web
Change to the Client 1 Web 1 web server directory:
Set the correct file permissions for all files and directories:
chown -R web1:client1 web
Your MariaDb database and user are now ready, note down your database name and database username and password. You will need that information later.
6.08 Configure WordPress
Open a browser and enter http://mydomain.com to start the WordPress installation page to finalize the WordPress server.
Click âContinueâ to finalize the WordPress installation:
Youâll be told to get your MariaDb database information ready, click âLetâs go!â:
Now you will see the screen to enter the WordPress MariaDb database information.
Enter in the WordPress MariaDb database name, username and password. Once you are sure the information is correct, click âSubmitâ:
If your WordPress MariaDb database information was correct and you see this atta boy Sparky message, click âRun the installationâ:
Now you will be at the Welcome screen where needed information will need to entered.
Enter the Site Title, WordPress Username, WordPress Password and your email address and click âInstall WordPressâ:
If all goes as planned you should see this âSuccess!â screen letting you know that the WordPress installation was successful and is now ready for you to start to design your web site.
Now confirm your default ISPConfig web site home home page changed to the default WordPress home page. You should see you home page now looks like this:
6.09 Log Into WordPress
Now we need to confirm we can log into WordPress. Open a web browser and enter this URL âmydomain.com/wp-admin and you should see the WordPress login screen for your web site.
Enter your WordPress username and password and click âLog Inâ:
If you see the WordPress Dashboard, you have successfully logged into your web site.
6.10 Install âChange wp-admin loginâ Plugin
Now it is time to better secure your WordPress login screen. The âwp-adminâ log in directory is routinely attacked by a world of hackers. From the Dashboard sidebar menu select Plugins -> Add New:
You will be at the Add Plugins Screen.
Search for plugin named âChange wp-admin loginâ. Install and then Activate the plugin.
Search for plugin named âChange wp-admin loginâ. Install and then Activate the plugin.
You will return to the Plugins home page. You should see Change wp-admin login has been installed and activated.
From the WordPress Dashboard sidebar menu select Settings -> Permalinks.
Your now at the Permalink Settings screen. Scroll down to the bottom of the page.
You will see a Change wp-admin login section. Enter what you want to use as your administration log in link and click âSave Changesâ:
You will see your new login page link
6.11 Set MyDomain.com As The Default Server Website (Optional)
If you would type in your server’s IP address (http://192.168.0.150) you will see the Apache2 Debian default web page like this:
This can be accomplished by copying the information from the MyDomain.com Apache2 configuration file into the Apache2 default configuration file. First lets back up the original file with this command:
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf_bkup
Now we can overwrite the Apache2 default file with the MyDomain.com configuration file using this command:
cp /etc/apache2/sites-available/mydomain.com.vhost /etc/apache2/sites-available/000-default.conf
To make the change happen we need to restart Apache2:
systemctl restart apache2
Refresh the browser viewing your server’s IP address and you will now see the MyDomain.com homepage.
This completes your own Debian 11 web site hosting server.