Apache/ko

The Apache HTTP Server is an efficient, extensible web server. It is one of the most popular web servers used the Internet.

Global support
Enabling the  global USE flag provides support for Apache in other packages. This may cause to be installed automatically if a package depending on Apache has been emerged.

After configuring USE variables, update the system so the changes take effect:

설정 파일
There are two main files that configure Apache2's behavior on the system:


 * Gentoo's Apache2 init script configuration file


 * Apache2 server's conventional configuration file

The file located in  is Gentoo's init script configuration file. The only active line in this file is the  line:

This line defines options that will be interpreted by the various configuration files using the  statement to activate or deactivate some part of the whole configuration. This will be returned to later in the article.

The file is Apache server's conventional configuration file. In fact this file is only an entry point for configuration. The whole configuration is split in many files in the directory, that are assembled together using the   directive. For example, the statement, in , aims at including all the files in  which name ends with.

Taking into account what has been said in the subsection above, and as module configuration files (files in ) almost always start with the, the content of one file inside , will ONLY be assembled with the rest of the configuration, if the matching option is set using a   flag in the   variable in the  file. The configuration file is an exception to this rule as it doesn't start with an   statement and therefore is always included in the resulting configuration.

기본 설정
After a fresh install of an Apache server, the configuration resulting from the assemblage of the different configuration files is as follows. Start with the entry point.

첫 생존 신호
As visible in the initial configuration above, the pre-installed virtual host's   directory is, its server name is localhost. In addition an index.html file is provided in the  directory, thus to check whether everything is correctly installed or not, point a browser to http://localhost/.

An "It works!" message should be printed on the page.

Enabling mod_security
Install :

Enable the  module in the  file's   variable:

Control this module by editing and  files, then restart Apache.

PHP 지원 활성화
Install PHP with the  USE flag and enable the module:

PHP 모듈이 동작하는지 시험하기 전에 파일이 있는지, 다음 정의가  있는지 확인하십시오:

If it does not exist create it.

To verify the PHP module works, create a test page:

Now, suppress or rename and open the test page: http://localhost/

A table describing the PHP settings should be visible.

Modify PHP versions
To change the version of PHP handled by Apache, first list the available versions for the  Server Application Programming Interface (SAPI):

Change it to the version of choice:

Substitute  in the example above to the requested number in the output of eselect php list apache2 as displayed earlier on.

Virtual hosts
For each virtual host, provide a  directory that is reachable and accessible by the Apache daemon. Add a virtual host configuration file in the  directory which uses this   and the virtual host server name. Do not forget to add an entry for this domain name in.

To assign the apache user/group ownership on the virtual host files, use chown like in the following example:

아래 두가지 가상 호스트 정의 예제에서 하나는 domainname1.com, 다른 하나는 domainname2.com에 대한 정의입니다. 호스트 부분은 같게 내버려 두지만, 와    지시자의 값은 다름을 눈여겨 보십시오:

이와 같이 IP 기반 가상 호스트 정의를 제공하는 것도 추천합니다. IP 주소를 통해 사이트에 접근하려는 사용자에게 관리자가 메시지를 뿌릴 수 있게 합니다.

가상 호스트를 넣은 다음, 서버는 새 사이트를 활성화 하기 위해 (적절하게) 재시작해야 합니다.

fcgid를 통한 PHP 활성화
Install and. The PHP package requires  to be set as a USE flag:

파일을 편집하십시오:

필요한 디렉터리를 만드십시오:

PHP 래퍼에 대한 심볼릭 링크를 만드십시오:

fcgid 모듈을 활성화 하십시오:

마지막으로 아파치를 다시 시작하고 먼저 만든 페이지의  사이트가 뜨는지 확인하십시오. 값은 "CGI/FastCGI"여야 합니다.

아파치 2.4에서 mod_proxy_fcgi를 통한 PHP-FPM 활성화
PHP 5.3 이상에서, PHP에서는 FastCGI 프로세스 관리자 또는 FPM 추가 모드를 지원합니다.

The following method relies on the FilesMatch directive and be placed within the main server config or VirtualHosts. The location of the UNIX socket is determined by the listen directive in the, allowing for specifying separate pools per site or function.

In the following example, it is placed within the PHP module config file of Apache:

By default the  directive is not set to a socket. First create the directory for the socket file:

Next, update the file as follows:

PHP 모듈과 프록시 모듈을 활성화합니다:

OpenRC
Start the Apache server:

Add Apache to the default runlevel:

Restart the Apache service:

Reload Apache configuration files:

systemd
Start the Apache server:

Add Apache to the default runlevel:

Restart the Apache service:

Resources
The Apache server can be difficult to configure properly. Below are some resources that may be helpful when issues occur:


 * Troubleshooting guide

Testing
Verifying IP interfaces and ports on which Apache2 is running on and listening to:

Testing if a connection to a Apache server is working on localhost:

Interrupt the connection test with + and.

apr_sockaddr_info_get failed for 
Error:

apache2: apr_sockaddr_info_get failed for System_Hostname

Resolution:

When this occurs, add the host name to the file:

추가 참조

 * Lighttpd - A fast, lightweight web server.
 * Nginx - A small, robust, and high-performance HTTP server and reverse proxy.

외부 자원

 * Slicehost 게시물: 젠투에 아파치 설치하기
 * Slicehost 게시물: 젠투에서 아파치 설정하기
 * Slicehost 게시물: 젠투에서 아파치 MPM 설정하기
 * Slicehost 게시물: 젠투에서 아파치 설정하기
 * Slicehost 게시물: 젠투에서 아파치 가상 호스트 설정하기
 * Slicehost 게시물: 젠투에서 아파치 mod_status 활성화 하고 사용하기
 * apache.org 문서
 * 아파치 2 mod_pagespeed