테스트 환경
NCP 리눅스 서버 1대 생성
OS : CentOS 7.8
Apache 버전 : 2.4.51
1) Apache설치
yum install java-1.8*
wget https://downloads.apache.org/httpd/httpd-2.4.51.tar.gz
wget https://downloads.apache.org/apr/apr-1.6.5.tar.gz
wget https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz
tar -zxvf httpd-2.4.51.tar.gz
tar -xvzf apr-1.6.5.tar.gz
tar -xvzf apr-util-1.6.1.tar.gz
mv apr-1.6.5 httpd-2.4.51/srclib/apr
mv apr-util-1.6.1 httpd-2.4.51/srclib/apr-util mkdir /apache
yum install expat-devel
2) Apache 컴파일
./httpd-2.4.51/configure --prefix=/apache/httpd-2.4.51 --with-included-apr --enable-so --enable-ssl=shared --with-ssl=/usr/local/ssl --enable-rewrite --with-included-apr-util --with-included-pcre
make
make install
3) Apache 서비스 등록
vi /usr/lib/systemd/system/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)
[Service]
Type=forking
PIDFile=/apache/httpd-2.4.51/logs/httpd.pid
ExecStart=/apache/httpd-2.4.51/bin/apachectl start
ExecReload=/apache/httpd-2.4.51/bin/apachectl graceful
ExecStop=/apache/httpd-2.4.51/bin/apachectl stop
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-user.target
vi /apache/httpd-2.4.51/conf/httpd.conf
내용중 user, group 에 daemon이라고 되어있는부분 nobody로 수정
4) Apache 시작,확인,종료
systemctl daemon-reload
systemctl start httpd
systemctl status httpd
systemctl stop httpd
vi /apache/httpd-2.4.51/conf/httpd.conf (내용에서 DocumentRoot & Directory 변경)
DocumentRoot "/var/www/html" <Directory "/var/www/html">
vi /var/www/html/index.html (생성후 편집)
<h1> web01 server running </h1>
systemctl enable httpd;systemctl start httpd
웹페이지 확인 or 서버에서 curl -s http://localhost
'Linux Server' 카테고리의 다른 글
[Linux] Ubuntu MySQL 8.0 데이터 저장소 변경 (0) | 2022.09.16 |
---|---|
[Linux] Ubuntu MySQL 8.0 root계정 설정 (0) | 2022.09.16 |
[Linux] Ubuntu 에서 Apache 설치(컴파일) (0) | 2022.09.13 |
[Linux&Window] Zabbix Server & Agent 설치하기 (0) | 2022.07.18 |
[CentOS 7.8] Grafana-Node Exporther-Prometheus 구성하기 (0) | 2022.07.18 |