최대 1 분 소요

Apache는 가장 널리 사용되는 오픈소스 웹 서버입니다. 이번 글에서는 리눅스 서버에서 Apache를 설치하고 기본 설정하는 방법을 안내합니다.

1. Apache 설치

RockyLinux, CentOS, Fedora 등에서는 아래 명령어로 설치합니다.

sudo dnf install httpd -y

Ubuntu/Debian 계열에서는:

sudo apt update
sudo apt install apache2 -y

2. 서비스 시작 및 부팅 시 자동 실행

sudo systemctl start httpd      # CentOS/RockyLinux
sudo systemctl enable httpd

sudo systemctl start apache2    # Ubuntu/Debian
sudo systemctl enable apache2

3. 방화벽 설정

HTTP(80), HTTPS(443) 포트를 엽니다.

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

4. 기본 설정 파일 위치

  • CentOS/RockyLinux: /etc/httpd/conf/httpd.conf
  • Ubuntu/Debian: /etc/apache2/apache2.conf

5. 설정 테스트 및 재시작

설정 변경 후 아래 명령어로 오류를 확인하고 서비스를 재시작합니다.

sudo apachectl configtest
sudo systemctl restart httpd      # CentOS/RockyLinux
sudo systemctl restart apache2    # Ubuntu/Debian

Apache를 설치하고 기본 설정을 마치면 다양한 웹 서비스를 안정적으로 운영할

카테고리: ,

업데이트:

댓글남기기