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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. kdocker: command not found
  2. CentOS / RHEL : How to configure an DHCP server
  3. codespell: Spellchecker for source code
  4. pstree: command not found
  5. How to configure iSCSI Initiator (client) in CentOS / RHEL 6
  6. How to use netstat command under Linux (Examples included)
  7. vnstat Command Examples in Linux
  8. CentOS / RHEL : How to add swap file
  9. View files using – cat, more, tail, head and wc commands
  10. How to use auditd to monitor a specific SYSCALL

You May Also Like

Primary Sidebar

Recent Posts

  • “glab pipeline” Command Examples
  • “glab mr” Command Examples
  • “glab mr merge” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright