Unavailable Localhost on Linux (Ubuntu)
If you have several sites on your local (Apache) instance, most probably you’ll end up having one of them not working sometimes, and it can be even localhost. Reason for that is missing default in your /sites-enabled folder in Apache2 configuration.
To fix the issue, either make a link to default configuration from sites-available, or use Ubuntu’s handy feature a2ensite / a2dissite.
To use first method, run: (depending on where your Apache2 is installed, and default exists inside /sites-available)
# /etc/apache2 OR /path-to-your/apache2 sudo ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/default
To use latter method, you can disable e.g. mysite and enable localhost in terminal:
sudo a2dissite mysite sudo service apache2 reload
This will disable mysite, having localhost enabled automatically. This assumes that you have /etc/hosts file configured properly.
Share this story:
Leave a Reply