메뉴 건너뛰기

2015.07.16 19:00

아파치 설치

조회 수 7864 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

아파치 설치
#yum -y install httpd


아파치 환경설정
#vi /etc/httpd/conf/httpd.conf


User apache ==> User nobody 로 변경
Group apache ==> Group nobody 로 변경
ServerName ==> 도메인명 입력 하거나 없으면 ip 입력

 

#service httpd start : httpd 실행

 

 

방화벽마법사 설치

yum -y install system-config-firewall

 

#system-config-firewall-tui 로 실행

firewall : enabled 체크

customize 선택 - www (HTTP) 체크후 close - OK - YES 로 빠져나온다.

shutdown -r now 로 리부팅한다.

 

방화벽 오픈
#vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 추가
( iptables 에서 순서는 매우 중요함, 적용되는 순서가 위에서 부터 아래로 감 )


방화벽 재시작 및 확인
#service iptables restart (방화벽 재시작)
#iptables -nL (정상적으로 작동되는지 확인)

 

부팅시 iptables 시작

systemctl enable iptables


아파치 삭제​
#yum erase httpd*
#yum remove httpd*


아파치 시작
#service httpd start​


아파치 서비스 상태확인, 시작, 중지, 재시작
#service httpd status
#service httpd start​
#service httpd stop​​
#service httpd restart


아파치 설치된 위치
​​#which httpd


아파치 버전 보기
#아파치 설치된 위치 -v

 

재부팅시 자동시작 방법


Apache 실행 스크립트인 apachectl을 /etc/init.d에 httpd라는 파일명으로 복사
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

chkconfig를 이용해 자동실행을 등록
# chkconfig --add httpd

이 명령어를 실행해보면 "service httpd does not support chkconfig(httpd 서비스는 chkconfig를 지원하지 않습니다.)"라는 오류가 납니다.


3. chkconfig를 사용하기 위한 설정
httpd 파일을 열어서 다음과 같은 부분을 추가합니다.

# vi /etc/init.d/httpd

vi 에디터 상에서
#!/bin/sh
# chkconfig: 2345 90 90
# description: init file for Apache server daemon
# processname: /usr/local/apache2/bin/apachectl  (아파치설치경로)
# config: /usr/local/apache2/conf/httpd.conf  (아파치설치경로)
# pidfile: /usr/local/apache2/logs/httpd.pid  (아파치설치경로)
#

위 코드를 입력

 

다시 등록을 합니다.

# chkconfig --add httpd

이번에는 오류 없이 등록되는 것을 확인할 수 있습니다.

# chkconfig --list | grep httpd    (등록되었는지 확인)


/etc/init.d./httpd stop
/etc/init.d./httpd start 명령으로 아파치 종료, 시작을 처리할 수 있습니다.

 

#chkconfig httpd on
#chkconfig --list httpd

 

chkconfig 명령어

* 서비스 runlevel 보기
chkconfig --list
chkconfig --list 데몬명

 

* 서비스 등록
chkconfig --add 데몬명
 
* 서비스 삭제
chkconfig --del 데몬명
 
* 서비스 runlevel 조정
chkconfig --level 실행레벨 데몬명 [on|off|rest]


List of Articles
번호 제목 날짜 조회 수
237 & 실행과 nohup 실행 2017.04.18 7841
236 AIDE를 이용한 리눅스 파일 시스템의 무결성 점검 2014.03.26 8555
235 apache + mysql 자동 실행 방법 (소스설치) 2014.02.27 7966
234 Apache 2.2.17 + WebLogic 10.3.3 연동하기 2016.11.22 8798
233 Apache 2.x 에서 maxclients 1024 제한 초과 방법 (수정 중..) 2016.03.18 8558
232 Apache Mod_Security 사용방법 2016.04.22 8922
231 apache status 모듈 ( 모니터링 ) 2014.02.27 8501
230 apache vhost deny 설정 2014.03.26 7587
229 apache 구동중지되어있을 때 재구동 스크립트 2016.03.18 7373
228 Apache 동시접속자수 확인 2019.02.14 1932
227 apache 로그정리 (logrotate) 2014.02.27 7453
226 Apache 리다이렉트 2016.03.18 8155
225 Apache 웹서버 server-status 모니터링 2014.02.27 8074
224 Apache 웹서버 server-status 모니터링 file 2014.03.26 6954
223 apache 컴파일시 동시 접속자 제한 변경하기 2014.03.26 8157
222 Apache 환경 설정 파일 정보 (httpd.conf) 2016.09.19 7472
221 Apache(아파치)를 사용해 redirect(리다이렉트) 하는 방법 7 2014.02.27 7667
220 apache, mod_ssl 설치 (apache 1.3.37버전) 2014.02.27 7667
219 APACHE, OHS 400 웹로직 연동후 특정 작업에 400 error 2016.12.30 8646
218 apache2 트래픽 모듈 mod_cband 사용법 2019.02.14 1129
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 12 Next
/ 12

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved