메뉴 건너뛰기

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
번호 제목 날짜 조회 수
137 php sockets 동적 모듈 설치 ( php socket ) 2016.03.18 8324
136 php 리다이렉트 2016.03.18 8302
135 php-5.2.17 make시에 오류 발생 make: *** [ext/dom/node.lo] 오류 1 2016.03.18 10744
134 PHP-5.3 이상 Zend 설치 2015.07.30 8698
133 php-mbstring 설치 2015.07.16 7776
132 php.ini 파일에서 timezone 설정 2015.07.16 7754
131 PHPIZE를 이용한 openSSL PHP 확장 모듈 설치 2016.09.11 8063
130 php_fpm 관련 자료 2017.09.20 5318
129 php_screw를 이용한 php 소스 암호화 하기 2019.02.14 1420
128 Proftp 설치 2014.03.26 7022
127 qmail 587 포트 추가 2014.03.26 7388
126 rdate명령어 사용법과 옵션 file 2017.11.22 6300
125 Rocky Linux 8에 docker 설치하기 file 2024.04.23 0
124 Root Disk를 Mirroring하는 방법 2016.07.22 8410
123 root 계정 su 명령 제한 file 2023.01.20 136
122 rsync ssh를 이용한 서버 백업 2016.03.18 9006
121 rsync 와 ssh 를 이용한 네트워크 백업하기 2014.02.27 7747
120 SAMBA 설치 2014.02.27 7315
119 sendmail 587 포트 사용 2014.03.26 7728
118 Snort란 2014.02.27 7873
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 12 Next
/ 12

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved