레이블이 linux linuxmint mint apache http httpd source compile install 리눅스 민트 리눅스민트 아파치 소스 설치 컴파일인 게시물을 표시합니다. 모든 게시물 표시
레이블이 linux linuxmint mint apache http httpd source compile install 리눅스 민트 리눅스민트 아파치 소스 설치 컴파일인 게시물을 표시합니다. 모든 게시물 표시

2016년 5월 29일 일요일

LinuxMint Apache source 설치

 


1. Apache 설치전 APR 설치
 


$ wget http://apache.tt.co.kr/apr/apr-1.5.1.tar.gz
$ tar zxvf apr-1.5.1.tar.gz
$ cd apr-1.5.1
$ ./configure --prefix=/apm/server/apr
$ make; make install

 


 


2. APR-ICONV 설치
 


$ wget http://apache.tt.co.kr/apr/apr-iconv-1.2.1.tar.gz
$ tar zxvf apr-iconv-1.2.1.tar.gz
$ cd apr-iconv-1.2.1
$ ./configure --prefix=/apm/server/apr
--with-apr=/apm/server/apr/bin/apr-1-config
--with-crypto=/usr --with-openssl
--with-dbm=db47 --with-gdbm --with-berkeley-db
--with-mysql=/apm/server/mariadb
--with-sqlite3
--with-expat=/usr
$ make; make install

 


 


3. APR-UTIL 설치
 


$ wget http://apache.tt.co.kr/apr/apr-util-1.5.4.tar.gz
$ tar zxvf apr-util-1.5.4.tar.gz
$ cd apr-util-1.5.4
$ ./configure --prefix=/apm/server/apr
--with-apr=/apm/server/apr/bin/apr-1-config
--with-openssl
--with-gdbm
--with-mysql=/apm/server/mariadb
$ make; make install

 


 


4. PCRE 설치
 


$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
$ tar zxvf pcre-8.36.tar.gz
$ cd pcre-8.36
$ ./configure
$ make; make install

 


 


5. PCRE 의존 라이브러리 설치
 


$ apt-get install libfindlib-ocaml libpcre++-dev libpcre++0 libpcre-ocaml libpcre-ocaml-dev libpcre3-dbg libpcre3-dev libpcrecpp0 ocaml-base-nox ocaml-compiler-libs ocaml-findlib ocaml-interp ocaml-nox

 


 


6. APACHE 설치
 


$ wget wget http://apache.tt.co.kr/httpd/httpd-2.4.10.tar.gz
$ tar zxvf httpd-2.4.10.tar.gz
$ cd httpd-2.4.10
$ ./configure --prefix=/apm/server/apache --sysconfdir=/apm/server/apache/conf
--with-apr=/apm/server/apr/bin/apr-1-config --with-apr-util=/apm/server/apr/bin/apu-1-config
--with-pcre --with-libxml2 --with-ssl --with-z
--with-mpm=worker
--enable-modules=most --enable-mods-shared=most
--enable-file-cache --enable-cache --enable-file-cache
--enable-so
--enable-mime-magic --enable-expires --enable-header
--enable-proxy --enable-ssl
--enable-mpms-shared=all
--enable-vhosts-alias --enable-rewrite
$ make; make install

 


 


7. APACHE 환경 설정


 


로그를 “/apm/server/apache” 폴더로 저장하기 위해서 설정하기 전에 폴더를 생성


 


$ mkdir /apm/server/apache

 


도큐먼트 루트 디렉토리 생성


 


$ mkdir /apm/doc

 


설치시 환경 설정 경로(–sysconfdir)를 “/apm/server/apache/conf” 폴더로 설정했기 때문에 “/apm/server/apache/conf” 폴더에 설정 파일들이 생성되어 있다.
 


$ cd /apm/server/apache/conf
$ vi httpd.conf

 


사용할 모듈의 주석을 제거하여 활성화한다.


 


.....
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule dav_module modules/mod_dav.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
.....

 


그룹 계정 비활성화


 


<IfModule unixd_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>

 


관리자 이메일


 


ServerAdmin admin@my.domain

 


서버 이름


 


ServerName 127.0.0.1

 


도큐먼트 루트 디렉토리


 


DocumentRoot "/apm/doc"
<Directory "/apm/doc">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

 


폴더로 접근할 때 실행하는 인덱스 파일 설정


 


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

 


로그 파일 저장 위치


 


# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "/apm/server/apache/error_log"
<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
    LogFormat "%h %l %u %t "%r" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog /apm/server/apache/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access_log" combined
</IfModule>

 


설정 파일 import


 


# Server-pool management (MPM specific)
Include /etc/httpd/extra/httpd-mpm.conf
# Language settings
Include /etc/httpd/extra/httpd-languages.conf

 


MPM 설정


 


$ vi extra/httpd-mpm.conf

 


#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
# Note that this is the default PidFile for most MPMs.
#

    PidFile "/apm/server/apache/httpd.pid"

 


LANGUAGES 설정


 


$ vi extra/httpd-languages.conf

 


DefaultLanguage ko

# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
LanguagePriority ko en ca cs da de el eo es et fr he hr it ja ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW

 


 


8. 서비스 등록


 


apachectl 스크립트는 chkconfig 로 동작할 수 있도록 수정해야 한다.


Symbolic Link 를 만들고 apachectl 스크립트의 상단 부분을 아래와 같이 수정해야만 서비스로 추가가 가능하다.


 


$ ln -s /apm/server/apache/bin/apachectl /etc/init.d/apache
$ vi /apm/server/apache/bin/apachectl

 


#!/bin/sh
#
# Apache This starts and stops Apache.
#
# chkconfig: 35 20 80
# description: Apache Web Service
#
# Licensed to the Apache Software Foundation
.....

 


 


9. APACHE Server 시작


 


$ service apache start

 


 


10. 공유 라이브러리 추가


 


$ echo "/apm/server/apache/module" >> /etc/ld.so.conf
$ ldconfig

 


11. Test Index 문서 생성


 


$ echo "TEST" > /apm/doc/index.html

 


12. APACHE Server Testing