본문 바로가기

Applications/Nginx

nginx.conf 파일 설명

# nginx.conf 파일 설명

이 nginx.conf파일은 Nginx 웹 서버의 기본 구성 파일이다. 여기에는 Nginx가 서버 구성, 위치 및 기타 전역 설정과 같은 작업의 다양한 측면을 처리하는 방법을 정의하는 지시문과 설정이 포함되어 있다.
다음은 파일의 기본 예이다.

- nginx.conf 파일을 설명하면 아래와 같다.

user nginx; //user : Nginx 작업자 프로세스를 실행하는 데 사용할 사용자를 지정합니다.
worker_processes auto; //작업자 프로세스 수 : 작업자 프로세스 수를 구성합니다.
error_log /var/log/nginx/error.log; //error_log : 오류 로그가 기록될 파일을 정의합니다.
pid /var/run/nginx.pid; //pid : 메인 프로세스의 프로세스 ID가 기록되는 파일을 지정한다.

events {
    worker_connections 1024; //events : 연결 처리와 관련된 매개변수를 구성합니다.
}

http { //http : 기본 HTTP 구성 블록입니다.
    include /etc/nginx/mime.types; //include /etc/nginx/mime.types : MIME 유형을 포함합니다.
    default_type application/octet-stream;
	// log_format : 액세스 로그의 형식을 정의합니다.
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
	//access_log : 액세스 로그가 기록될 파일을 지정합니다.
    access_log /var/log/nginx/access.log main;
	//sendfile, tcp_nopush, tcp_nodelay : 다양한 성능 관련 설정입니다.
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65; //keepalive_timeout : 연결이 유휴 상태로 유지될 수 있는 최대 시간을 설정합니다.
    types_hash_max_size 2048;
	//include /etc/nginx/conf.d/*.conf : 추가 구성 파일을 포함합니다.
    include /etc/nginx/conf.d/*.conf;
    //include /etc/nginx/sites-enabled/ *: 개별 사이트에 대한 구성을 포함합니다.
    include /etc/nginx/sites-enabled/*;
}

 

- 끝 -

'Applications > Nginx' 카테고리의 다른 글

Nginx 웹서버 설치 (우분투 OS)  (0) 2022.02.17