Notice
Recent Posts
Recent Comments
Link
«   2025/03   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Archives
Today
Total
관리 메뉴

쟝이의 세상

mac OS homebrew (Apache 80포트 변경하기) 본문

자료

mac OS homebrew (Apache 80포트 변경하기)

zyangee 2024. 10. 4. 21:29

💡 기본 세팅

✔️ SSL 설치

brew install openssl

 

✔️ Apache 웹 서버(httpd) 중지

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
1) launchctl unload
launchctl 명령어 - macOS에서 시스템의 데몬(백그라운드 서비스)을 제어하는데 사용
unload 옵션 - 특정 데몬을 비활성화 또는 중지한느 역할

2) -w
: launchctl이 데몬을 "영구적으로 비활성화" 하도록 지시
즉, 시스템이 재부팅되더라도 해당 데몬이 자동으로 시작되지 않도록 설정

3) /System/Library/LaunchDaemons/org.apache.httpd.plist
Apache 웹 서버의 launch daemon 설정 파일 (Apache는 기본적으로 macOS에 내장되어 있음)

4) 2>/dev/null
에러 메시지를 무시하고 출력하지 않도록 설정. 오류가 발생하더라도 콘솔에 표시되지 않음

👇🏻 결과 화면

더보기

DocumentRoot를 확인할 수 있음

→ /opt/homebrew/var/www

✔️ Apache 실행

brew services start httpd
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/jihyang/Library/LaunchAgents/homebrew.mxcl.httpd.plist` exited with 5

위와 같은 오류가 발생

많은 이유가 있겠지만, 바로 실행 가능했던 방법
→ Homebrew의 Apache(httpd) 관련 LaunchAgent나 LaunchDaemon이 잘못된 상태일 수 있으므로 이를 정리
rm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
sudo rm /Library/LaunchDaemons/homebrew.mxcl.httpd.plist

기존 파일이 제거되었으므로 새로 생성될 수 있도록 설정을 복구. httpd 서비스 재등록 후 다시 실행 시도

brew services restart httpd

 

📎 (선택사항). index.html 파일 수정

더보기

(위치: /opt/homebrew/var/www/index.html)

✔️ localhost:8080 접속

 

 

📌 설정파일 수정

✔️ httpd.conf 파일 수정

명령어를 통해 httpd.conf 파일 visual code 로 열기

code /opt/homebrew/etc/httpd/httpd.conf

 

1. 포트 변경

Listen 80​

→ Listen 8080에서 Listen 80으로 변경


2. User, Group 변경

User [user_name]
Group staff

mac에서 Homebrew로 설치한 Apache를 사용하는 경우, 기본적으로 Apache는 현재 사용자의 권한으로 실행된다.

→ 사용자 MacBook 이름으로 설정해주면 된다.

💡 현재 사용자의 계정을 확인하는 방법
whoami​

명령어로 반환되는 사용자 이름을 User 디렉티브에 설정하면 된다.

 

3. Servername 변경

ServerName localhost

 

✔️ localhost 접속

 

 

'자료' 카테고리의 다른 글

Ubuntu 에서 DNS 서버 구축  (0) 2024.10.08
mac OS homebrew (DNS 서버 구축)  (0) 2024.10.06
kubenetes 서비스 노출과 버전 업데이트  (0) 2024.10.04
추가 보안 적용  (0) 2024.09.20
추가 보안 적용 (Ubuntu)  (0) 2024.09.17