25 09 2014
Linux (centos)에 Apache HTTPD 2.2.29 install
Contents
기본설치
1 |
yum -y install gcc gcc-c++ openssl-devel perl |
다운로드
http://httpd.apache.org/download.cgi#apache24
사이트에서
1 2 3 |
root]# wget http://mirror.apache-kr.org//httpd/httpd-2.2.29.tar.gz root]#tar xvf httpd-2.2.29.tar.gz |
압축해제
필요한 파일 설치
Apache2.4.x 버전 설치
기존의 apache2.4.x 버전부터는 apr과 apr-util을 별로도 설치하여야 합니다.
하위버전에서는 설치파일에 포함되어 있었으나 버전 업이 되면서 삭제되어
configure를 실행하면 아래와 같은 에러메시지를 발생하면서 종료됩니다.
Checking for APR… no
Confgirue: error: APR not found. Please read the documentation
소스 수정
1 2 3 4 5 |
root]# vi [경로]/httpd-2.4.10/server/mpm/prefork/prefork.c #ifndef DEFAULT_SERVER_LIMIT #define DEFAULT_SERVER_LIMIT 2048 #endif |
1 2 3 4 5 |
root]# vi [경로]//httpd-2.4.10/server/mpm/worker/worker.c #ifndef DEFAULT_SERVER_LIMIT #define DEFAULT_SERVER_LIMIT 256 #endif |
설치(httpd-2.2.29)
MPM(worker)방식으로 설치
소스컴파일 및 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
root]#./configure \ --prefix=/app/httpd-2.2.29 \ --with-mpm=worker \ --enable-module=so \ --enable-mods-shared=most \ --enable-maintainer-mode \ --enable-deflate \ --enable-headers \ --enable-rewrite \ --enable-ssl \ --enable-proxy \ --enable-proxy-http \ --enable-proxy-ajp \ --enable-proxy-balance |
1 |
root]#make && make install |
설치확인
1 |
/app/httpd-2.2.29/bin/httpd -V |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
Server version: Apache/2.2.29 (Unix) Server built: Sep 25 2014 14:36:33 Server's Module Magic Number: 20051115:36 Server loaded: APR 1.5.1, APR-Util 1.5.3 Compiled using: APR 1.5.1, APR-Util 1.5.3 Architecture: 64-bit Server MPM: Worker threaded: yes (fixed thread count) forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/worker" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/app/httpd-2.2.29" -D SUEXEC_BIN="/app/httpd-2.2.29/bin/suexec" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" |
HTTPD 실행
1 2 3 |
root]#cd /app/httpd-2.2.29/bin root]#./apachectl start |
Service 설정
기존 HTTPD 삭제
1 2 3 4 5 |
root]# yum erase httpd httpd-tools apr apr-util root]#/cp /app/httpd-2.2.29/bin/apachectl /etc/init.d/httpd root]#vi /etc/init.d/httpd |
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server.
# processname: /app/httpd-2.2.29/bin/apachectl
# pidfile: /app/httpd-2.2.29/logs/httpd.pid
# config: /app/httpd-2.2.29/conf/httpd.conf
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the “License”); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache. Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
# XXX this doc is no longer correct now that the interesting
# XXX functions are handled by httpd
# 0 – operation completed successfully
# 1 –
# 2 – usage error
# 3 – httpd could not be started
# 4 – httpd could not be stopped
# 5 – httpd could not be started during a restart
# 6 – httpd could not be restarted during a restart
# 7 – httpd could not be restarted during a graceful restart
# 8 – configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported. Run “apachectl help” for usage info
#
ARGV=”$@”
#
# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
# ——————– ——————–
#
# Source function library
. /etc/rc.d/init.d/functions
#
# the path to your httpd binary, including options if necessary
HTTPD=’/app/httpd-2.2.29/bin/httpd’
#
# pick up any necessary environment variables
if test -f /app/httpd-2.2.29/bin/envvars; then
. /app/httpd-2.2.29/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line. Designed for lynx, however other
# programs may work.
LYNX=”links -dump”
#
# the URL to your server’s mod_status status page. If you do not
# have one, then status and fullstatus will not work.
STATUSURL=”http://localhost:80/server-status”
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES=”ulimit -S -n ulimit -H -n
”
# ——————– ——————–
# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
# Set the maximum number of file descriptors allowed per child process.
if [ “x$ULIMIT_MAX_FILES” != “x” ] ; then
$ULIMIT_MAX_FILES
fi
ERROR=0
if [ “x$ARGV” = “x” ] ; then
ARGV=”-h”
fi
case $ARGV in
start|stop|restart|graceful|graceful-stop)
echo -n “$ARGV httpd : “
daemon $HTTPD -k $ARGV
echo
ERROR=$?
;;
startssl|sslstart|start-SSL)
echo The startssl option is no longer supported.
echo Please edit httpd.conf to include the SSL configuration settings
echo and then use “apachectl start”.
ERROR=2
;;
configtest)
$HTTPD -t
ERROR=$?
;;
status)
$LYNX $STATUSURL | awk ‘ /process$/ { print; exit } { print } ‘
;;
fullstatus)
$LYNX $STATUSURL
;;
*)
$HTTPD $ARGV
ERROR=$?
esac
exit $ERROR
서비스 등록
root]#chkconfig –add httpd
=========================================================
리눅스 멀티 프로세스
방식
설정
1 2 |
[root@ns1 ~]# perl -pi -e "s/SERVER_LIMIT 256/SERVER_LIMIT 2048/g" server/mpm/prefork/prefork.c [root@ns1 ~]# perl -pi -e "s/SERVER_LIMIT 16/SERVER_LIMIT 32/g" server/mpm/worker/worker.c |
컴파일옵션
1 2 3 4 5 6 7 8 9 |
[root@ns1 ~]# ./configure \ --prefix=/usr/local/apache \ --enable-mods-shared=all \ --enable-module=shared \ --enable-rewrite \ --enable-ssl \ --with-ssl \ --with-mpm=worker \ --with-included-apr |
1 |
make && make install |