• macOS 기본 설치된 Apache 제외하고 Homebrew 설치하여 사용
  • macOS 기본 설치된 Apache 사용 방법
Apache 시작: `sudo apachectl start`
Apache 중지: `sudo apachectl stop`
Apache 재시작: `sudo apachectl restart`
Apache 상태 확인: `sudo apachectl status`

 


Homebrew를 통해 최신 Apache를 설치

  • Homebrew 설치 이후 아래 명령어 실행
$ brew install httpd

 

  • Apache 설정 파일
Apache 설정 파일은 /opt/homebrew/etc/httpd/httpd.conf에 위치합니다.
(Apple Silicon Mac에서는 /opt/homebrew/ 경로, Intel Mac에서는 /usr/local/etc/httpd/httpd.conf 경로에 위치할 수 있습니다.)

 

  • httpd.conf 파일 수정하여 아파치 설정 변경
$ nano /opt/homebrew/etc/httpd/httpd.conf
DocumentRoot 설정
웹 파일을 저장할 기본 디렉터리를 설정합니다. 기본값은 /opt/homebrew/var/www입니다. 원하는 디렉터리로 변경할 수 있습니다.
포트 변경
기본적으로 포트 8080으로 설정됩니다. 80 포트를 사용하려면 Listen 값을 80으로 수정합니다.
Listen 80

 

  • Homebrew로 설치한 Apache 명령어
$ brew services start httpd
$ brew services stop httpd
$ brew services restart httpd

수동 명령
$ httpd -k start
$ httpd -k stop
$ httpd -k restart

 

+ Recent posts