Apache HTTP

How to Get Rid of Apache Test Page in Centos

Apache is the most widely used open-source web server known for its reliability, security, and flexibility. It can also be customized using the modules and extensions to meet the needs of different environments. Apache can be installed and operated across Linux, Windows, and MacOS.

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:

$ ls /etc/httpd/conf.d/

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:

$ sudo cp /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf_bak

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:

$ sudo rm /etc/httpd/conf.d/welcome.conf

You can also remove the /var/www/error/noindex.html file through the command below. This page actually displays the Apache default test page:

$ sudo rm /var/www/error/noindex.html

Now restart the Apache webserver through the command below:

$ sudo systemctl restart httpd.service

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:

$ sudo nano /etc/httpd/conf.d/welcome.conf

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:

$ sudo systemctl restart httpd.service

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.

$ sudo nano /var/www/html/index.html

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.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.