애플맥

[macOS] Apache 가상호스트 Virtual Host 설정


[macOS] Apache 가상호스트 Virtual Host 설정




최초 작성일 : 2021-09-12 | 수정일 : 2021-10-15 | 조회수 : 542

웹 서버 환경 확인 


sudo vi /etc/apache2/httpd.conf


아래 부분 주석 해제

# Virtual hosts

Include /private/etc/apache2/extra/httpd-vhosts.conf

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so


가상 호스팅 파일 편집

sudo vi /etc/apache2/extra/httpd-vhosts.conf



샘플

ServerAdmin webmaster@dummy-host2.example.com

DocumentRoot "/usr/docs/dummy-host2.example.com"

ServerName dummy-host2.example.com

ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"

CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common



    ServerName abc.com

    ServerAlias www.abc.com

    DocumentRoot "/Users/zauin/Sites/abc"

    ErrorLog "/private/var/log/apache2/abc.com-error_log"

    CustomLog "/private/var/log/apache2/abc.com-access_log" common

    ServerAdmin zauin@tera.co.kr



만약 등록된 도메인으로 직접 접근하고 싶은 경우만 아래 과정 할 것 


sudo vi /etc/hosts


127.0.0.1 abc.com www.abc.com


아파치 재시작 

sudo apachectl restart




sudo vi /etc/apache2/extra/httpd-vhosts.conf



ServerName localhost

DocumentRoot /Library/WebServer/Documents/



sudo apachectl restart



User Group 변경 

sudo vi /etc/apache2/httpd.conf


uid=502(admin) gid=20(staff)


User admin

Group staff





중요

디렉토리 접근 권한 해제


sudo vi /etc/apache2/httpd.conf


아래 확인 


AllowOverride none

Require all denied <-- 이녀석때문에 안됨


그대로 두고


아래 추가 

/Users/zauin/Sites/abc>

    Options Indexes FollowSymLinks

    AllowOverride All

    Require all granted

Tags  #Apache  

닉네임:
댓글내용:
🎖️ '애플맥' 카테고리의 다른 인기글
🚀 추천글
새글

애플컴퓨터 신제품, 2025년 출시될 최신 정보 총정리!
2025-08-23
  • 애플컴퓨터
  • 애플 신제품
  • 2025년 출시
애플컴퓨터 신제품, 2025년 기대작 총정리!
2025-08-22
  • 애플컴퓨터
  • 2025년 신제품
  • 맥북 프로
애플컴퓨터 신제품, 2025년 최신 소식 총정리!
2025-08-21
  • 애플컴퓨터
  • 2025년 신제품
  • 아이폰 17
애플컴퓨터 최신 소식: M4 칩 성능 폭발! 🚀
2025-08-20
  • M4 칩
  • 애플 M4
  • 애플 신제품
애플컴퓨터 최신 M5 칩 성능 '깜짝'!
2025-08-20
  • 애플 M5 칩
  • M5 칩 성능
  • 애플 실리콘
추천글
카슈미르, 전쟁의 불씨: 국제적 긴장의 중심에서의 갈등 분석
2025-08-20
  • 카슈미르분쟁
  • 인도파키스탄
  • 카르길전쟁




📸 이미지 프롬프트 복사 완료!
이제 어떤 이미지 생성 도구로 이동하시겠어요?
🧠 ImageFX 🧪 Whisk