네트워크

nginx express 연동

cghun 2021. 7. 6. 14:27

cd /etc/nginx/sites-enabled

 

sudo vi default

 

server {
	listen 80;
	listen [::]:80;

	access_log /var/log/nginx/reverse-access.log;
	error_log /var/log/nginx/reverse-error.log;

	location / {
		proxy_pass http://127.0.0.1:3000;
	}

}

esc -> :wq

 

확인

sudo nginx -t


nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

 

<정상>

 

 

nginx 재부팅

sudo service nginx restart

 

참고 사이트 

https://velog.io/@new_wisdom/AWS-EC2%EC%97%90-Node.jsExpress-pm2-nginx-%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0