728x90
[Centos7] 아파치 Apache (httpd) 설치
- Yum으로 설치 가능한 Apache(httpd) 버전 확인
$ yum list httpd
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
Available Packages
httpd.x86_64 2.4.6-97.el7.centos.5 updates
- Yum으로 Apache(httpd) 설치
$ yum install httpd
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
fedorapoject | 4.7 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): fedorapoject/updateinfo | 1.1 MB 00:00:00
(2/4): extras/7/x86_64/primary_db | 247 kB 00:00:00
(3/4): fedorapoject/primary_db | 7.0 MB 00:00:00
(4/4): updates/7/x86_64/primary_db | 16 MB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos.5 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos.5 for package: httpd-2.4.6-97.el7.centos.5.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.5.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.5.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.5.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-7.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.5 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================================================
Installing:
httpd x86_64 2.4.6-97.el7.centos.5 updates 2.7 M
Installing for dependencies:
apr x86_64 1.4.8-7.el7 base 104 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-97.el7.centos.5 updates 94 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
===========================================================================================================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 3.0 M
Installed size: 10 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(2/5): httpd-tools-2.4.6-97.el7.centos.5.x86_64.rpm | 94 kB 00:00:00
(3/5): apr-1.4.8-7.el7.x86_64.rpm | 104 kB 00:00:00
(4/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
(5/5): httpd-2.4.6-97.el7.centos.5.x86_64.rpm | 2.7 MB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 16 MB/s | 3.0 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-1.4.8-7.el7.x86_64 1/5
Installing : apr-util-1.5.2-6.el7.x86_64 2/5
Installing : httpd-tools-2.4.6-97.el7.centos.5.x86_64 3/5
Installing : mailcap-2.1.41-2.el7.noarch 4/5
Installing : httpd-2.4.6-97.el7.centos.5.x86_64 5/5
Verifying : apr-1.4.8-7.el7.x86_64 1/5
Verifying : mailcap-2.1.41-2.el7.noarch 2/5
Verifying : httpd-tools-2.4.6-97.el7.centos.5.x86_64 3/5
Verifying : apr-util-1.5.2-6.el7.x86_64 4/5
Verifying : httpd-2.4.6-97.el7.centos.5.x86_64 5/5
Installed:
httpd.x86_64 0:2.4.6-97.el7.centos.5
Dependency Installed:
apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-97.el7.centos.5 mailcap.noarch 0:2.1.41-2.el7
Complete!
- 설치한 Apache(httpd) 버전 확인
$ httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Mar 24 2022 14:57:57
- Apache(httpd) 실행
$ systemctl start httpd
- Apache(httpd) 상태 확인
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2022-07-11 10:57:57 KST; 1min 1s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 7756 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─7756 /usr/sbin/httpd -DFOREGROUND
├─7757 /usr/sbin/httpd -DFOREGROUND
├─7758 /usr/sbin/httpd -DFOREGROUND
├─7759 /usr/sbin/httpd -DFOREGROUND
├─7760 /usr/sbin/httpd -DFOREGROUND
└─7761 /usr/sbin/httpd -DFOREGROUND
Jul 11 10:57:57 playground.nips.local systemd[1]: Starting The Apache HTTP Server...
Jul 11 10:57:57 playground.nips.local httpd[7756]: AH00557: httpd: apr_sockaddr_info_get() failed for playground.nips.local
Jul 11 10:57:57 playground.nips.local httpd[7756]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive g... this message
Jul 11 10:57:57 playground.nips.local systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
- Apache(httpd) 80 포트 확인
$ netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 222.110.180.215:46070 192.168.188.1:389 ESTABLISHED
tcp 0 0 222.110.180.215:42128 192.168.188.2:3268 ESTABLISHED
tcp 0 0 222.110.180.215:44588 192.168.188.147:5514 ESTABLISHED
tcp 0 96 222.110.180.215:60022 10.3.4.14:55521 ESTABLISHED
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::60022 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
- Apache(httpd) 서버 재부팅 시 자동시작
$ systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
- 방화벽 설정 확인
$ vi /etc/firewalld/zones/public.xml
- 사용할 80 포트 추가
$ firewall-cmd --permanent --zone=public --add-port=80/tcp
- 방화벽 재구동
$ firewall-cmd --reload
- 방화별 설정 재확인
$ vi /etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<service name="dhcpv6-client"/>
<service name="ssh"/>
<port protocol="tcp" port="22"/>
<port protocol="tcp" port="80"/>
</zone>
- 외부 접속 테스트
브라우저에서 해당 서버의 주소를 입력하여 정상적으로 동작하는지 확인한다.
서버에 접근 불가능 시 원격 포트 확인 및 방화벽 확인한다.
2022.07.04 - [OS/WIndows] - telnet으로 원격 서버 포트 확인 / How to check a remote port is open
2022.07.05 - [OS/Linux] - [Centos7] firewall 방화벽 명령어
728x90
'OS & Server > Linux' 카테고리의 다른 글
[Centos7] Open JDK11 (JAVA Development Kit) 설치 (0) | 2022.07.14 |
---|---|
[Centos7] 아파치 Apache (httpd) 업데이트 (0) | 2022.07.11 |
[Centos7] firewall 방화벽 명령어 (0) | 2022.07.05 |
[Centos7] systemctl 명령어 사용법 (0) | 2022.07.05 |
[Centos7] [trouble shooting] httpd start failed due to SELinux (1) | 2022.07.04 |
댓글