프로젝트
nginx 명령문 및 설정예시파일
Jenner
2023. 11. 6. 15:19
엔진엑스 명령어모음
- 구성파일 확인 (구성파일에 오류가 있는지 확인)
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