목차

Apache

Apache 명령어

작업

아파치 실행 확인

apachectl status

아파치 실행

apachectl start

설정 파일 변경

/etc/httpd/conf/httpd.conf

vmware test

설치 : yum -y install httpd

httpd : /usr/sbin/httpd

apachectl : /usr/sbin/apachectl

conf : /etc/httpd/conf/httpd.conf

파일 경로

conf /etc/httpd/conf
/var/www/html
로그 /etc/httpd/logs
pid-file /etc/httpd/run/httpd.pid

아피치(apache) 시작, 중지, 리스타트

아파치 시작

apachectl start
httpd start

아파치 중지

apachectl stop
httpd stop

아파치 리스타트

apachectl restart
httpd restart

위와 같이 해서 안 될 경우

아파치 시작
/etc/rc.d/init.d/httpd start
아파치 중지
/etc/rc.d/init.d/httpd stop
아파치 리스타트
/etc/rc.d/init.d/httpd restart

상태확인

apachectl status

실행파일

/etc/init.d/httpd
/sbin/service httpd
/usr/sbin/apachectl

페도라 아파치 실행

service httpd start

접속 테스트

curl 127.0.0.1

아파치 구동상태 확인

ps -ef | grep httpd

service 명령어 이용

sudo service apache2 status

netstat 명령어 이용

sudo netstat -lntp | grep apache2

파일 확인

find / -name apachectl

아파치 버전 확인

/usr/local/apache/bin/httpd -v

httpd (아파치 데몬실행파일)

사용 옵션

-D name <IfDefine name> 지시자에 사용되는 이름을 정의함
-d directory 아파치실행시에 아파치의 Root 경로를 따로 지정해 줄 수 있음
-f file 아파치 설정파일을 직접 지정해 줄 수 있음
-C “directive” 아파치 설정파일을 읽기 의 process directive
-c “directive” 아파치 설정파일을 읽은 의 process directive
-v 아파치의 버전을 보여줌
-V 컴파일시 사용했던 옵션을 보여줌
-h httpd 실행시 사용할 수 있는 옵션들의 도움말을 보여줌
-l 컴파일시에 사용했던 모듈들을 보여줌
-L 설정가능한 지시자를 보여줌
-S 설정되어있는 가상호스트를 보여줌
-t 설정파일(httpd.conf)파일의 문법적인 체크를 할 수 있음
-T DocumentRoot 항목체크는 제외하고 설정파일의 문법적인 테스트함

모듈 설치

기존에 설치되어 있는 아파치에 모듈 추가 설치하기

  1. 아파치 소스 디렉토리로 이동 (없는 경우 동일 버전 다운로드 후 압축해제)
  2. 아래 명령으로 설치를 원하는 모듈의 소스 파일을 검색한다.

    find . -name “모듈이름”

  3. 아래 명령 실행

    {아파치 설치디렉토리}/bin/apxs -iax {2번에서 찾은 모듈경로}/모듈이름.c

  4. {아파치 설치디렉토리}/modules에 모듈이 추가 되어 있을 것이다.
  5. {아파치 설치디렉토리}/conf/httpd.conf 에 해당 모듈이 로딩하는 설정이 추가되어 있을 것이다.
  6. 각 모듈의 세부 설정을 추가한다.
  7. 아파치 재시작

    {아파치 설치디렉토리}/bin/apachectl restart

    또는

    {아파치 설치디렉토리}/bin/apachectl graceful

fedora

설치 과정

  1. FTP로 파일 전송
  2. 압축 풀고 (어디에?)

apxs 파일이 /usr/sbin 에 위치함

libxml 은 /usr/include/libxml2/

# apxs -c -I/usr/include/libxml2 -I. -i mod_proxy_html.c
# apxs -c -I/usr/include/libxml2 -I. -i mod_xml2enc.c

설정할 내용

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
LoadFile   /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule xml2enc_module modules/mod_xml2enc.so

참고


관련 문서