Mac

mac에 nginx 설치하기

OneBoard 2021. 1. 17. 23:50

mac에 기본 설치된 apache는 더이상 쓰지 않는 시스템이라서

회사의 시스템과 동일한 nginx를 설치 합니다.'

 

cornswrold.tistory.com/428

 

[nginx] mac os에 nginx를 설치해보자!!

아파치가 버전이 업될때 마다, 살펴볼 것이 많고 설정파일도 무척 복잡하여 nginx를 써보기로 했다. nginx가 가볍고 설정파일이 아파치에 비해 무척 쉽다는 소문만 들었다.. 삽질을 시작해보자. 일

blog.cornsworld.co.kr

설치는 brew를 이용하면 간단 합니다.

 

brew install nginx
brew services start nginx

 

설정 파일들은 아래의 디렉토리에 있습니다.

 

/usr/local/etc/nginx

 

설정파일을 수정하면 brew 명령어를 이용해서 서비스를 restart 합니다.

 

brew services restart nginx

 

nginx를 brew로 설치했기 때문에

사용자가 허용가능한 1000번 이상의 포트인 8080이 nginx의 기본 포트 입니다.

 

httpd://localhost:8080

 

80포트로 nginx를 구동하려면, nginx.conf의 포트를 8080에서 80으로 수정 합니다.

 

vi /usr/local/etc/nginx/nginx.conf

 

listen 뒤의 8080을 80으로 바꾸면 됩니다.

    server {
        listen       80;
        server_name  localhost;

 

그리고, brew를 이용해서 nginx를 restart 합니다.

 

oneboard@oneboarcBookPro nginx % brew services restart nginx
Stopping `nginx`... (might take a while)
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)

 

반응형