If you’re setting up Apache on Ubuntu, you might come across an error message stating that the system “Cannot find /etc/apache2/sites-available/default”. This error typically arises when you are following a tutorial or guide based on an older version of Ubuntu. In this article, we will guide you through the steps to resolve this issue.
To fix the ‘Cannot find /etc/apache2/sites-available/default’ error when configuring Apache on Ubuntu, you can either modify the tutorial instructions to use the correct file name (
000-default.conf), or create a new configuration file named
default using the command
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default.
Understanding the Error
Before we delve into the solution, it’s important to understand why this error occurs. Prior to Ubuntu 13.10, the default configuration file for Apache was located at
/etc/apache2/sites-available/default. However, in newer versions, the default configuration file is now named
000-default.conf and is located at
If you’re following a guide based on an older version of Ubuntu, the instructions will likely direct you to modify or interact with the
default file, which no longer exists in the newer versions. This discrepancy is the root cause of the error.
To resolve this issue, you have two options. You can either modify the tutorial instructions to use the correct file name (
000-default.conf), or create a new configuration file with a different name, such as
Modifying the Instructions
This is the simplest solution. Wherever the tutorial instructs you to interact with
For example, if the tutorial instructs you to open the default configuration file with the command
sudo nano /etc/apache2/sites-available/default, you should instead use the command
sudo nano /etc/apache2/sites-available/000-default.conf.
Creating a New Configuration File
If you prefer to follow the tutorial exactly as it is written, you can create a new configuration file named
default using the following command:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default
In this command,
sudo gives you superuser privileges,
cp is the command to copy files,
/etc/apache2/sites-available/000-default.conf is the source file, and
/etc/apache2/sites-available/default is the destination. Essentially, this command creates a copy of the
000-default.conf file and names it
You can then proceed with the tutorial using the newly created
Remember, the tutorial you are following may have other outdated instructions due to the version difference. Therefore, it’s recommended to cross-reference with the official Apache documentation or updated tutorials specific to your version of Ubuntu.
By understanding the root cause of the ‘Cannot find /etc/apache2/sites-available/default’ error and knowing how to resolve it, you can successfully configure Apache on your Ubuntu system.
This error occurs because the default configuration file for Apache has changed in newer versions of Ubuntu. Instead of being named "default" and located at "/etc/apache2/sites-available/default", it is now named "000-default.conf" and located at "/etc/apache2/sites-available/000-default.conf".
There are two ways to fix this error. One option is to modify the tutorial instructions to use the correct file name, "000-default.conf", instead of "default". The other option is to create a new configuration file named "default" by copying the "000-default.conf" file using the command "sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default".