Today in this post, we will be going to answer a common question about how to get rid of the Apache test page in the CentOS operating system. When you install Apache, a default test page welcome.conf is created inside the Apache configuration directory /etc/httpd/conf.d. This default page is used to test the proper functioning of the Apache server. After installing the Apache server, you can test its proper functioning by directing your browser to http://localhost or your server IP address. If you are welcomed by the HTTP server test page, as shown in the screenshot below, the Apache server is working correctly and ready to use.
How to Get Rid of Apache Test Page
To get rid of the Apache test page, either remove the welcome.conf file or comment out the configurations of the welcome.conf file. Before moving towards both methods, first, locate the welcome.conf file is located in the /etc/httpd/conf.d directory. To locate the file, open the Terminal and run the command below:
In the output, you will find the welcome.conf file.
Note: Before removing or altering the welcome.conf file, you can create its backup file in case you later need it. Run the command below to backup this file:
Method#1
To get rid of the Apache test page, you will need to remove the welcome.conf file located under the /etc/httpd/conf.d directory. This is the configuration file used to display the test page of Apache. You can remove the /etc/httpd/conf.d/welcome.conf file through the command below:
You can also remove the /var/www/error/noindex.html file through the command below. This page actually displays the Apache default test page:
Now restart the Apache webserver through the command below:
Method#2
Another way to get rid of the Apache test page in CentOS is to comment out all the lines in the welcome.conf file located under the /etc/httpd/conf.d/ directory.
Edit the /etc/httpd/conf.d/welcome.conf file using the command below:
The contents of the welcome.conf file will look like as shown in the screenshot below. This is the default welcome.conf configuration provided by Apache.
To get rid of the Apache test page, comment out all lines in the file. You can do this by appending each line with a hash symbol (#), as shown in the screenshot below:
Now restart the Apache webserver through the command below:
Now to verify if the Apache test page has been removed and you can view the pages in the Apache document root directory, create an HTML file index.html in the /var/www/html directory.
Add any sample content and then save and close the file.
Now reload the browser and point it to http://localhost or your server IP address. This time you will see the new index.html file instead of the default Apache test page.
That is all there is to it! I hope you have learned how to get rid of the Apache Test page in the CentOS system.