Develop/🍩 Nginx
NGINX 설정 파일 위치 확인하기
인피니
2025. 6. 5. 01:31
웹서버 구성을 확인하고 싶을 때가 있다..
사용하고 있던 웹서버는 nginx 였고, 해당 설정 파일이 어디에 위치해 있는지 알기 위해
설정 파일 위치를 확인하는 명령어를 찾아보았다.
sudo nginx -t
위 명령어는 설정파일을 읽어서 문법 오류, 잘못된 include 경로, 포트 충돌등을 검사해 준다.
문제가 있으면 오류 메시지를 출력 & 이상이 없으면 "ok" 메시지를 출력해 준다.
1) 설정이 정상일 때
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
2) 설정에 문제가 있을 때
$ sudo nginx -t
nginx: [emerg] unexpected end of file, expecting "}" in /etc/nginx/nginx.conf:45
nginx: configuration file /etc/nginx/nginx.conf test failed
요기서 the configuration 부분뒤에 설정파일의 위치를 알 수 있다.