Apache2

From Gentoo Linux Wiki
Jump to: navigation, search
This article is not very long. You could help Gentoo-Wiki by editing this article.

Apache2 TOC

Apache Software Foundation Logo

Contents

[edit] Summary

This is the index for all articles related to Apache 2. Apache 2 is a HyperText Transfer Protocol daemon. HTTP is the backbone of the Web. For further information on the history of Apache and other trivial data, visit The Apache HTTP Server Project page.

[edit] Installation

For an Apache2 server you will need to emerge apache:

emerge apache
Note: Sys V IPC must be built into your kernel. General Setup --> [*] System V IPC

The directory of ROOT is in /var/www/localhost/htdocs/

In case you want to allow the users to have their own webpages (public_html), then do:

echo "www-servers/apache userdir" >> /etc/portage/package.use emerge apache
Warning: use flags have moved to APACHE2_MODULES and APACHE2_MPMS keywords in www-servers/apache-2.2.6-r4 and above. See this article in the official gentoo documentation.

After that you also need to edit the file /etc/conf.d/apache2 and add "-D USERDIR" to APACHE2_OPTS as shown:

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D USERDIR"

Then every user has to make a public_html directory in order to put his/her index.html and any other files in there.

[edit] 00_mod_userdir.conf

If you want to allow just some users to have their own web pages, then you have to edit the userdir module in:

/etc/apache2/modules.d/00_mod_userdir.conf

and add to it the following lines:

Code: add to 00_mod_userdir.conf
UserDir public_html
UserDir disabled
UserDir enabled user1 user2 root

[edit] Starting the Apache2 Server

/etc/init.d/apache2 start

[edit] To add Apache to default runlevel (startup)

rc-update add apache2 default

[edit] Configuration

Configuration files for server behavior and site definition(s) are kept in the /etc/apache2/ directory.

The configuration file for Apache's Init script is located at: /etc/conf.d/apache2. (This file is where you will add PHP, SVN and SSL support to the Web server.)

[edit] Serving more than one site from a single server

You're looking to do virtual hosts if you're looking to serve more than one site. Enable the vhost_alias APACHE2_MODULES flag to build support for virtual hosts. There are two styles of virtual hosts you can use: IP-based and name-based. Name-based virtual hosts are pretty much what everyone will want to use. See the Virtual Hosts subpage for more details.

[edit] See Also

Personal tools
In other languages