1. 아파치 다운 : http://www.apache.org/dist/httpd/

2. 리눅스로 복사

3. 설치

# ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-so --enable-rewrite
configure: error: no acceptable C compiler found in $PATH 요런 메세지 뜨면 gcc(C컴파일러없는거임, 설치)

#apt-get install gcc
[정상적인 결과]
...................... 생략 ........................
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands

4. make
[root@wiki httpd-2.2.15]# make && make install
[정상적인 결과]
............... 생략 ..................
Installing man pages and online manual
mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory `/usr/local/download/httpd-2.2.15'

5. 환경 설정

[root~/]# vi /home/apache/conf/httpd.conf

5.1

변경전 변경후
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nobody

</IfModule>
</IfModule>


5.2

변경전 변경후
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName
www.example.com:80
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName
123.123.123.123:80


5.3

변경전 변경후
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>


5.4

변경전 변경후
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


6. 아파치 가동
[root~/]# /usr/local/apache/bin/apachectl start

Apache 설정이 완료되었으며, Apache를 실행하여 웹서버가 동작하는지 확인한다.
리눅스 방화벽에서 웹서버 포트를 열어주는 것은 잊지말자.

7. 브라우저로 자신의 아이피로 접속한다.

웹서버가 동작하는 것을 확인 할 수 있다.


8. 아파치 자동 시작 설정
[root@wiki httpd-2.2.15]# vi /etc/rc.local

아래와 같이 변경하여 서버가 재부팅 되더라도 웹서버가 자동으로 실행 할 수 있게 변경한다.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/local/apache/bin/apachectl start

[참조] http://kspot.tistory.com/entry/%EB%A6%AC%EB%88%85%EC%8A%A4-Apache-%EC%84%A4%EC%B9%98

+ Recent posts