Apache is an open-source HTTP server for modern operating systems, including UNIX and Windows. The goal is to provide a secure, efficient and extensible server to provides HTTP services in sync with the current HTTP standards.
Let's see how to disable the default Apache (httpd) welcome page on Redhat Linux. All Apache configuration file with extension .conf located within /etc/httpd/conf.d/.
First, you need to locate the file called /etc/httpd/conf.d/welcome.conf. It is the page that is displayed as the Welcome Page. We need to rename its configuration /etc/httpd/conf.d/welcome.conf, to disable the default “Welcome” page configuration.
Disabling Apache Welcome Page
Solution #1: removing/renaming Welcome Page
1. In order to disable this page, we have to rename the file /etc/httpd/conf.d/welcome.conf
to something else or you can simply delete it if you don’t need it.
# mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf_backup
2. Make sure that Apache is restarted (as root) with the command:
# systemctl restart httpd
Solution #2: Allow Indexes in /etc/httpd/conf.d/welcome.conf
1. The default Apache Welcome page will display unless /etc/httpd/conf.d/welcome.conf is modified to allow Indexes. Edit /etc/httpd/conf.d/welcome.conf
to allow Indexes.
2. Comment the Options line (add a # mark) in /etc/httpd/conf.d/welcome.conf
as shown below:
# vi /etc/httpd/conf.d/welcome.conf
<LocationMatch "^/+$">
# Options -Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>
Or you can enable Indexes by changing the –
to a +
# vi /etc/httpd/conf.d/welcome.conf
<LocationMatch "^/+$">
Options +Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>
3. The Apache service (httpd) is restarted for the changes to take effect.
# systemctl restart httpd
Verify
Let's add a sample index.html page in the Document Root to verify if the Welcome Page is disabled and can view the pages in the Document Root.
# echo "<h1>This is a Test Page</h1>" > /var/www/html/index.html
All done. Now, open your favourite browser and point it to the server IP address. You must see a page like the one shown in the screenshot below.