해당 튜토리얼를 시작하기 전에 brew 패키지 관리자가 설치되어 있는지 확인해주세요! (링크)
NGINX 설치하기
1
brew install nginx
brew를 이용해 NginX를 설치해준다.
nginx.conf 파일 경로 확인
1
brew info nginx
brew info ${패키지명}을 이용하면 해당 패키지가 어디에 설치되어 있는지 확인 할 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
nginx: stable 1.19.8 (bottled), HEAD HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server https://nginx.org/ /opt/homebrew/Cellar/nginx/1.19.8 (25 files, 2.2MB) * Poured from bottle on 2021-04-06 at 16:08:43 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/nginx.rb License: BSD-2-Clause ==> Dependencies Required: openssl@1.1 ✔, pcre ✔ ==> Options --HEAD Install HEAD version ==> Caveats Docroot is: /opt/homebrew/var/www
The default port has been setin /opt/homebrew/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. ...
맥 버전에 따라 설치 위치가 다를 수 있으니 확인 부탁드립니다. 저는 /opt/homebrew/etc/nginx/nginx.conf에 설치 되어 있군요.
80 포트로 변경
기본 포트가 8080으로 되어있는 경우 80포트로 변경한다.
1
sudo vim /opt/homebrew/etc/nginx/nginx.conf
1 2 3 4
server { # listen 8080; listen 80; ...
홈 디렉토리 심볼릭 링크
nginx.conf 파일을 확인해보면 다음과 같이 root가 설정 되어 있다.
1
sudo vim /opt/homebrew/etc/nginx/nginx.conf
1 2 3 4 5 6
server { ... location / { root html; index index.html index.htm; }
brew services # 자동으로 homebrew/services를 tap, 현재 설치된 서비스 목록 확인 brew services [run|start|stop|restart|cleanup] service_name # 명령어 # run - 시작하되, 시작프로그램으로 등록하지 않음 # start - 시작하고 시작프로그램으로 등록