Posts tagged document
Apache 2 Manage Modules and Sites – Configuration Structure
Feb 14th
Apache2 implements a structured method of organizing and enabling/disabling modules and sites. The default apache2 host is automatically turned on in /etc/apache2/sites-enabled/, and it includes the virtual hosting option. Therefore, by default, virtual hosting is enabled. Create your virtual host containers in /etc/apache2/sites-available, and then enable them by issuing the command:
sudo a2ensite xxxxx.com
VirtualHost containers are easy to format, and can point to any directory. An example virtualhost container is:
<VirtualHost *>
DocumentRoot /www/example1
ServerName www.example1.com
</VirtualHost>
# Other directives here
I tend to place the document roots in my main users home directory. Then chmod the entire document root with owner and group as your username, and then chmod it 775. A permission of 775 will give the owner and group write permissions. Then add www-data, the user running apache2, to your group:
sudo adduser www-data username
Now www-data can write to the document root, which comes in handy for many php solution including blogging software.
Modules are also managed using the a2 command. Use a2enmod/a2dismod respectively. Although with some modules like php5, when you install it the module is loaded automatically:
sudo apt-get install libapache2-mod-php5
Apache2 changed how the configuration files are coordinated. It is much more neater than containing everything in the httpd.conf file. Now there is the ports.conf file, and the sites-available/mod-available, and sites-enabled/mods-enabled directories. Essentially no real modification is required in the new apache2.conf file. The default listening port is configured in /etc/apache2/ports.conf.
Related articles by Zemanta
- How to Add Virtual Hostnames in Apache (helpdeskgeek.com)
- How To Set Up Apache2 With mod_fcgid And PHP5 On OpenSUSE 11.2 (howtoforge.com)
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=fe98f757-f8d7-492b-afd9-59769c3eacbf)
