개발환경 | 맥(Mac) httpd, nginx 설치 및 실행

|

요약

아파치(httpd) 와 Nginx 를 맥에서 설치하는 방법입니다.
편의성을 위해 두개 중 하나만 설치하고 사용해야 합니다. (포트가 중복되면 같이 사용 불가)
두 방법 모두 homebrew 를 설치해야합니다.

아파치 설치하기

brew install httpd

DocumentRoot is /opt/homebrew/var/www.

The default ports have been set in /opt/homebrew/etc/httpd/httpd.conf to 8080 and in
/opt/homebrew/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

To restart httpd after an upgrade:
  brew services restart httpd
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND

brew services start httpd

접근은 127.0.0.1:8080 으로 하거나, localhost:8080으로 진행하면 됩니다.

접속 포트 수정하기

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

만약 포트를 수정하고싶다면 위의 명령어를 입력하여 (vs code 설치 필요)
포트를 수정할 수 있습니다.

nginx 설치하기

brew install nginx

Docroot is: /opt/homebrew/var/www

The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /opt/homebrew/etc/nginx/servers/.

To restart nginx after an upgrade:
  brew services restart nginx
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/nginx/bin/nginx -g daemon off;

brew services start nginx

접근은 127.0.0.1:8080 으로 하면 됩니다.

nginx -V
/opt/homebrew/etc/nginx/

가상 도메인 설정 (Host)

라라벨의 경우 라라벨 발렛 을 활용하여 호스트 설정을 할 수 있습니다.

참조

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

클릭하여 복사