Localhost is an internal server running directly on your computer. Working with localhost is essential to ensure everything runs smoothly before deploying a website publicly. So, how do we install localhost?
Understanding XAMPP
XAMPP is an application used to create and manage an internal server (localhost). When you create localhost with XAMPP, you get integrated Apache, PHP, FTP Server, MySQL. Overall, this software is comprehensive and user-friendly, helping you set up and develop websites.
It remains a top choice for web developers using the PHP language.
Download and Install XAMPP
Preparation before installation
- Remove all software related to localhost (if any), such as MySQL, PHP, etc.
- Turn off the Windows firewall or antivirus software (Avast, BKAV, etc.), as it may block the Webserver port. Refer to the guide: https://Mytour/huong-dan-bat-tat-tuong-lua-firewall-trong-windows/
- Disable User Account Control on Windows. See the guide: https://Mytour/cach-bat-tat-uac-tren-windows-10/
Download and Install XAMPP
Step 1: Visit the https://www.apachefriends.org/index.html website, choose one of the three versions suitable for your operating system to download XAMPP.

Step 2: After downloading XAMPP, open the file and proceed with the installation:

Select the applications in XAMPP that you want to install, paying attention to the important components Apache, PHP, and MySQL.

Choose the XAMPP storage location; it's recommended to keep it at the default C drive, as this is where localhost is created and stored.

Uncheck the 'Learn more about Bitnami for XAMPP' option and click Next.

Wait for the XAMPP installation process to complete. Click Finish.

Utilize XAMPP to set up localhost.
Step 1: Open the XAMPP software, in the language selection box, choose English.

Step 2: On the main interface of XAMPP, click start for both Apache and MySQL applications.

When both applications turn green, it's complete.

Step 3: Open a web browser and enter the address http://localhost; you will see the XAMPP interface.

Congratulations! You've successfully created localhost on your computer with the help of XAMPP and its allies. The address for localhost is in the form of http://localhost or http://127.0.0.1/.
Operations on localhost
1 - Understanding the folder structure of the path
Step 1: Access the directory C:\xampp\htdocs and create a new folder with any name. This folder is where your website will be stored.

Step 2: Add any file to the newly created folder.

Step 2: Open a web browser, access the path http://localhost/your-folder-name-you-just-set. You will see the index of that folder and a list of files inside.

So, you can observe that the website path will follow the hierarchical structure of folders and files.
2 - Create a MySQL database
Step 1: Access the path http://localhost/phpmyadmin/ to open the localhost management interface. Select Databases.

Step 2: Enter the name of the Database you want, select the code 'utf8_general_si' >> Create.

Following these steps, you have completed the process of creating a database with the following information:
- Database Host: localhost
- Database User: root
- Database Password: <leave blank>
- Database Name: The name you set for the Database, mine is Mytour
After reading the article, you should be able to successfully utilize XAMPP to create and manage localhost. From here, you can start building your website according to your preferences on localhost.