When you install Apache or Nginx on a fresh Linux server, the first thing you see in the browser is a default welcome page. This page confirms the web server is running, but leaving it in place on a production server tells visitors (and attackers) that the server is not fully configured. This guide covers how to remove or replace the default welcome page on both Apache and Nginx, for RHEL 10/Rocky 10/AlmaLinux 10 and Ubuntu 24.04.

What Causes the Default Welcome Page

The welcome page is served when no other virtual host or server block matches the incoming request. Each web server handles this differently:

  • Apache on RHEL/Rocky/Alma – A file called /etc/httpd/conf.d/welcome.conf defines a fallback that serves the Red Hat welcome page from /usr/share/httpd/noindex/
  • Apache on Ubuntu – The default virtual host file at /etc/apache2/sites-enabled/000-default.conf points to /var/www/html/, which contains index.html with the Apache2 default page
  • Nginx on RHEL/Rocky/Alma – The default server block in /etc/nginx/nginx.conf serves content from /usr/share/nginx/html/
  • Nginx on Ubuntu – The default site symlink at /etc/nginx/sites-enabled/default serves from /var/www/html/

Remove Apache Welcome Page on RHEL 10 / Rocky 10 / AlmaLinux 10

On RHEL-family distributions, the welcome page is controlled by welcome.conf. The cleanest approach is to rename it so Apache ignores it (Apache only loads files ending in .conf from conf.d/):

sudo mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak

Verify the syntax is still valid after the change:

sudo apachectl configtest

You should see Syntax OK. Restart Apache to apply the change:

sudo systemctl restart httpd

Now create a proper VirtualHost for your site. Create a new configuration file:

sudo nano /etc/httpd/conf.d/mysite.conf

Add the following VirtualHost block:


    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com
    ErrorLog /var/log/httpd/example.com-error.log
    CustomLog /var/log/httpd/example.com-access.log combined

    
        AllowOverride All
        Require all granted
    

Create the document root and add a test page:

sudo mkdir -p /var/www/example.com
echo "

Site is working

" | sudo tee /var/www/example.com/index.html

Set proper ownership and permissions:

sudo chown -R apache:apache /var/www/example.com
sudo chmod -R 755 /var/www/example.com

Test the configuration and restart:

sudo apachectl configtest
sudo systemctl restart httpd

Verify with curl:

curl -s http://localhost

You should see your custom page content instead of the default welcome page.

Remove Apache Default Page on Ubuntu 24.04

On Ubuntu, Apache uses the sites-enabled/sites-available pattern. The default virtual host is symlinked as 000-default.conf:

ls -la /etc/apache2/sites-enabled/

Disable the default site using the a2dissite utility:

sudo a2dissite 000-default.conf

You can also remove the default index page from the document root:

sudo rm /var/www/html/index.html

Create your own virtual host configuration:

sudo nano /etc/apache2/sites-available/example.com.conf

Add:


    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com
    ErrorLog ${APACHE_LOG_DIR}/example.com-error.log
    CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined

    
        AllowOverride All
        Require all granted
    

Enable the new site, create the document root, and restart:

sudo a2ensite example.com.conf
sudo mkdir -p /var/www/example.com
echo "

Site is working

" | sudo tee /var/www/example.com/index.html sudo chown -R www-data:www-data /var/www/example.com

Test and reload:

sudo apachectl configtest
sudo systemctl reload apache2

Verify the result:

curl -s http://localhost

Remove Nginx Default Page on RHEL 10 / Rocky 10 / AlmaLinux 10

On RHEL-family systems, the Nginx default server block is defined directly in /etc/nginx/nginx.conf. Open the file and comment out or remove the existing server block inside the http context:

sudo nano /etc/nginx/nginx.conf

Find the server { } block that contains listen 80 and either comment it out with # or delete it entirely. Then create a new server block configuration file:

sudo nano /etc/nginx/conf.d/example.com.conf

Add:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }

    access_log /var/log/nginx/example.com-access.log;
    error_log /var/log/nginx/example.com-error.log;
}

Create the document root and test page:

sudo mkdir -p /var/www/example.com
echo "

Site is working

" | sudo tee /var/www/example.com/index.html sudo chown -R nginx:nginx /var/www/example.com

Test the configuration and restart:

sudo nginx -t
sudo systemctl restart nginx

Verify:

curl -s http://localhost

Remove Nginx Default Page on Ubuntu 24.04

On Ubuntu, Nginx uses the sites-available/sites-enabled pattern similar to Apache. The default site is symlinked:

ls -la /etc/nginx/sites-enabled/

Remove the default symlink:

sudo rm /etc/nginx/sites-enabled/default

The original file remains in /etc/nginx/sites-available/default in case you need to reference it later. Now create your site configuration:

sudo nano /etc/nginx/sites-available/example.com

Add:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }

    access_log /var/log/nginx/example.com-access.log;
    error_log /var/log/nginx/example.com-error.log;
}

Enable the site by creating the symlink:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Create the document root:

sudo mkdir -p /var/www/example.com
echo "

Site is working

" | sudo tee /var/www/example.com/index.html sudo chown -R www-data:www-data /var/www/example.com

Test and restart:

sudo nginx -t
sudo systemctl restart nginx

Verify with curl:

curl -s http://localhost

Understanding the Default Document Root

Each distribution and web server combination uses a different default document root:

  • Apache on RHEL/Rocky/Alma/var/www/html/ (configured in /etc/httpd/conf/httpd.conf)
  • Apache on Ubuntu/var/www/html/ (configured in /etc/apache2/sites-available/000-default.conf)
  • Nginx on RHEL/Rocky/Alma/usr/share/nginx/html/ (configured in /etc/nginx/nginx.conf)
  • Nginx on Ubuntu/var/www/html/ (configured in /etc/nginx/sites-available/default)

When you create custom virtual hosts or server blocks, always define an explicit document root rather than relying on the defaults. This keeps your site files separate and makes management cleaner when you host multiple sites.

Hiding Server Version Information

While you are removing default pages, it is also good practice to hide the web server version from HTTP response headers. This does not prevent attacks, but it removes easy reconnaissance for automated scanners.

For Apache, add to the main configuration:

ServerTokens Prod
ServerSignature Off

For Nginx, add inside the http block:

server_tokens off;

Verify the headers are clean using curl:

curl -I http://localhost

The Server header should show just “Apache” or “nginx” without a version number.

Conclusion

Removing the default welcome page is one of the first things to do after installing a web server. On RHEL-family systems, rename or remove welcome.conf for Apache, or edit the server block in nginx.conf for Nginx. On Ubuntu, disable the default site with a2dissite for Apache, or remove the default symlink in sites-enabled for Nginx. Always replace the default with a proper virtual host or server block, verify the configuration with the built-in test command, and confirm the result with curl. These are small steps, but they set the right foundation for a properly configured web server.

LEAVE A REPLY

Please enter your comment!
Please enter your name here