엔진엑스 명령어모음
- 구성파일 확인 (구성파일에 오류가 있는지 확인)
sudo nginx -t
- nginx 중지
sudo systemctl stop nginx
- nginx 상태 확인
sudo systemctl status nginx
- nginx 연결 끊지 않고 구성을 다시 불러오도록 지시
sudo systemctl reload nginx
- nginx 다시시작
sudo systemctl start nginx
- 실행중인 nginx 프로세스 pid확인
ps aux | grep nginx
- nginx conf파일
sudo find / -name nginx.conf //nginx.conf파일 위치 찾기
sudo vi /etc/nginx/nginx.conf //nginx.conf파일 vim으로 열기
- nginx 접속로그 파일 위치
/var/log/nginx/access.log
- nginx 에러로그 확인
sudo journalctl -xe
- nginx 에러로그 파일 위치
/var/log/nginx/error.log
- nginx 구성파일 예시
구성파일 위치
sudo vi /etc/nginx/sites-available/default
"etc/nginx/sites-available/default" [New DIRECTORY] 0,0-1 All
346:12)
#
# include snippets/snakeoil.conf;
root /home/prj/build;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.html;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
"/etc/nginx/sites-available/default" 91L, 2435C 51,17-31 57%
#
# include snippets/snakeoil.conf;
root /home/elice/project/front/build;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.html;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
"/etc/nginx/sites-available/default" 91L, 2435C
nginx에 대한 참고 글
'프로젝트' 카테고리의 다른 글
장바구니 기능 구현 방안 고민 (1) | 2023.11.24 |
---|---|
1차 프로젝트 회고 (0) | 2023.11.07 |
useMemo와 React.memo의 차이 (1) | 2023.11.03 |
[jwt] refresh token으로 memory에 저장되어있던 사라진 access token 재발급 받기 (0) | 2023.03.13 |
[오류수정] 로그아웃 후 다시 로그인했을 때 보호된 리소스에 접근 오류 (0) | 2023.03.10 |