Zero To One

Nginx 명령어 모음 본문

WAS and Server

Nginx 명령어 모음

Zero_To_One 2022. 3. 2. 20:17

Nginx 실행

service nginx start
sudo service nginx start
sudo systemctl start nginx

Nginx 상태보기

service nginx status
sudo service nginx status
ps -ef | grep nginx

Nginx 재실행

service nginx restart
sudo service nginx restart
sudo nginx -s reload
sudo systemctl restart nginx

Nginx 중단

service nginx stop
sudo service nginx stop
sudo systemctl stop nginx

 

nginx 실행 후,

  • Mac OS : /opt/homebrew/etc/nginx 에서 nginx.conf.default를 cat을 사용해 확인한다
  • Ubuntu :
    • /etc/nginx/conf.d/default.conf 또는
    • /etc/nginx/sites-available/default 파일을 cat을 사용해 확인한다.

나같은 경우, 다음과 같은 위치에 있다.

$ cd /etc/nginx/conf.d
$ ls
$ cat default.conf

 

 

이걸 열어보면

나 같은 경우, www.localhost:10024를 검색해보면 nginx의 기본 홈페이지가 뜬다.

 

살펴보자면,

listen이 PORT 번호,

location에 root 는 정적파일이 있는 경로

index는 정적파일로 볼 수 있겠다.

 

물론 수정도 가능하다.