What is /etc/apache2/sites-available used for and is it necessary?
Google is your friend;
/etc/apache2/sites-available This contains configuration files for sites which are available but not necessarily enabled.
/etc/apache2/sites-enabled This directory contains site files which are enabled.
From here -> http://www.debian-administration.org/articles/412
Basically, you want to setup your vhost files (.conf files) in sites-available and then create a symbolic link in sites-enabled for each one. This way, you only update the configs in sites-available.
**See the first comment below, this is preferable to manually creating the symlink.
Related videos on Youtube
Mariane
Updated on September 18, 2022Comments
-
Mariane over 1 year
I have 3 sites, each with a specific IP, running on apache2 (up-to-date Ubuntu).
To put a site online, I just created a file in:
/etc/apache2/sites-enabled
and in this file I told apache which directory was the root directory for this site, and to which IP it should correspond.
So I have
000-default
,001-www.lapf.eu
,002-www.felkin.info
and003-www.seidhr.fr
in this directory.My first site, lapf suddenly lost contact with its database after the domain name was transferred from another registrar unto the registrar who is also hosting the site's data.
Then I did an update, and I reinstalled mysql-server and mysql-common, and I did I-have-forgotten-what to reinstall the locales (uft8 and such) which had vanished for some reason.
This fixed my first site.
Now I noticed that the other 2 sites are offline. Pointing a browser to them just hangs until timeout. They used to function, and their domain names did not move, they are still registered at the same place.
The files are still in /etc/apache2/sites-enabled
I noticed another directory:
/etc/apache2/sites-available
with just defaut and default.ssl in it.
Why are there 2 directories, sites-enabled and sites-available? Should I copy the files from "sites-enabled" into "sites-available"? Or should I put a modified version of each in "sites-available"?
command: "apache2ctl -S" VirtualHost configuration: 92.243.20.169:80 Charlotte (/etc/apache2/sites-enabled/001-www.lapf.eu:1) 92.243.21.141:80 xvm-21-141.ghst.net (/etc/apache2/sites-enabled/002-www.felkin.info:1) 92.243.4.114:80 xvm-4-114.ghst.net (/etc/apache2/sites-enabled/003-www.seidhr.fr:1) wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server Charlotte (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost Charlotte (/etc/apache2/sites-enabled/000-default:1) Syntax OK
-
jscott over 10 yearsYou don't typically create the symlink by hand. On Debian, the
a2ensite
command will manage the enabled sites for you. -
sgtbeano over 10 yearsReally didn't know that, thanks :) (up vote for you)
-
ZVIK over 10 years@sgtbeano you can use a2dissite command to remove symbolic link too :-)
-
Admin over 10 yearsWelcome on serverfault, you can increase the quality of your post by editing it. You can for example type "man a2ensite" and modify your answer accordingly. You can also improve formatting by adding line feeds.