Saturday, November 7, 2015

apache 2.2 - Purpose of debian "sites-available" and "sites-enabled" dirs



Can anyone tell me—in a nutshell—what the purpose of these two directories are in Debian?



/etc/apache2/sites-enabled
/etc/apache2/sites-available



I notice that diffing sites-available/000-default and sites-enabled/default shows they are identical.



What gives?


Answer



sites-available contains the apache config files for each of your sites. For example:




ServerName site.mysite.com

ServerAdmin my@email.com

DirectoryIndex index.php
DocumentRoot /home/user/public_html/site.mysite.com/public

LogLevel warn
ErrorLog /home/user/public_html/site.mysite.com/logs/error.log
CustomLog /home/user/public_html/site.mysite.com/logs/access.log combined




When you want to add a new site (for example, site.mysite.com), you add it here, and use:



a2ensite site.mysite.com


To enable the site. Once the site is enabled, a symlink to the config file is placed in the sites-enabled directory, indicating that the site is enabled.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...