We will first create our own default webpage in the document root so that we test whether this can be seen from other computers. To create our own default page, go to the “/var/www/html” directory. This is the document root of the server which is used to place the website files. Inside the directory, add an “index.php” file which will be our new page for the server. If you have multiple websites, you can create folders within the “/var/www/html”.
Make sure that you add the following code to the “index.php” file. This is of course a simple web page, you can create your own default web page for your server.
If the index.php file was created well, run “lynx http://localhost” and see that the default page is able to open as shown in the figure.
I will first show how to do this in Centos 7,8 and 9
On centos 7,8 and 9, the HTTP service can be allowed through the firewall by running the command “firewall-cmd –add-service=http –permanent”. The firewall can then be reloaded for the command to take effect using the command “firewall-cmd –reload”.
To allow the http service through the firewall on centos 6 and below, use the iptables command to allow port 80’s source and destination ports on both the input and output chains.
I tried opening the web page on my windows machine by opening my Microsoft edge browser and the typing “http://192.168.43.162” which is using the IP address of the virtual machine. As you can see, the web page was able to open well.