• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to disable the default apache “Welcome Page” in CentOS/RHEL 7

by admin

The Problem

When you install Apache 2, you would see the “Welcome Page” as shown below when you first open the URL IP of the server.

disable apache 2 welcome page in CentOS RHEL 7

You may not find this page in the default Document Root “/var/www/html” as well. How can we disable this page and have our own page being displayed?

The Solution

In order to change this behaviour, check to see if there is a file called /etc/httpd/conf.d/welcome.conf. This is the page that is displayed as the Welcome Page.

Disabling Apache Welcome Page

Method 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

Method 2 : allow Indexes in /etc/httpd/conf.d/welcome.conf

1. Without an index at the DocumentRoot, 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

Lets add a smaple index.html page in the Document Root to verify if we have disabled the Welcome Page and can view the pages in the Document Root.

# echo "<h1>This is a Test Page</h1>" > /var/www/html/index.html

Open the browser and point it to the server IP address. The page should look like the one shown in the screenshot below.

disable apache 2 welcome page in CentOS

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. “sudo: /etc/sudoers is world writable” – How to correct the permissions of sudoers file
  2. lastlog: command not found
  3. How to run rsyslog as a non-root user in CentOS/RHEL 7
  4. dpkg-reconfigure Command Options
  5. duperemove Command Examples in Linux
  6. CentOS / RHEL : How to block incoming and outgoing ports using iptables
  7. dnf: command not found
  8. How to use mdadm to create a software mirror on top of multipath devices
  9. “cannot install the best update candidate for package” – error on running dnf update
  10. losetup Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright