본문 바로가기
Node

nginx사용하기

by jennyiscoding 2023. 1. 28.

1. nginx다운로드

brew install nginx

 

2. 이렇게 nginx.conf가 어디 있는지 알수있음.

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

3. sudo nginx

localhost:8080 포트를 열수있음.

4. brew info nginx

nginx.conf가 어디 있는지 알수있음. 

5. nginx 종료하기

sudo nginx -s quit

6. nginx.conf 에서 port를 8080 -> 80으로 변경해주었음.

 

7. pm2 설치 : sudo npm i -g pm2

8. pm2 start index.js 했더니 되었음.. 

 

9. pm2 list : 뭐가 pm2에서 돌아가고 있는지 알수있음. 

10. nginx.conf를 이렇게 바꿔보았음

        location / {
            # root   html;
            # index  index.html index.htm;
            proxy_pass http://localhost:3000/;
        }

11. 서버를 껐다 킴. 

 

 

 

 

질문) nvm을 설치했는데 이게 대체 뭐냐..?

=> node버전관리해주는 거라고함.