webserv 용 config file 예시

# 워커프로세스의 권한을 지정
# root 대신 일반 계정으로 사용하는 것이 좋음
user  root;
# 서브젝트에서 cgi를 제외하면 fork()를 불허하였으므로 프로세스 1개 사용
worker_processes  1;

events {
	# 몇 개의 접속을 동시에 처리할 것인지 결정
	worker_connections  1024;
}

# serer, location 의 루트 블록
# 여기서 설정된 값들은 하위 블록들에게 상속됨
http { 
	# 다른 설정 파일을 포함시킬 때에 사용
	# include       mime.types;
	# include       xxx.conf

	# 기본값은 옥텟 스트림(8비트 단위의 바이너리 데이터)으로 설정
	# default_type  application/octet-stream;

	# 어떤 인코딩 방식을 사용하는지?
	charset utf-8;
 
	# 기본 에러 페이지 설정
	error_page 400 error_pages/400.html
	error_page 403 error_pages/403.html
	error_page 404 error_pages/404.html
	error_page 405 error_pages/405.html
	error_page 500 error_pages/500.html
	error_page 505 error_pages/505.html
    
	# keepalive 로 유지되는 커넥션의 최대 대기 시간
	keepalive_timeout  65;
	# keepalive로 유지되는 커넥션의 최대 처리 요청수
	keepalive_requests 100;    

	# 클라이언트 리퀘스트 바디를 읽기 위한 버퍼 크기를 설정
	client_body_buffer_size 16k;
	# 클라이언트 리퀘스트 바디를 읽기 위한 타임아웃 시간 설정
	client_body_timeout 60s;
	# 클라이언트 리퀘스트 헤더를 읽기 위한 버퍼 크기 설정
	client_header_buffer_size 1k;
	# 클라이언트 리퀘스트 헤더를 읽기 위한 타임아웃 시간 설정
	client_header_timeout 60s;
	#클라이언트가 보낸 리퀘스트 바디의 최대 사이즈
	client_max_body_size 1m;

	server {
		listen 4242;

		# 클라이언트가 접속할 주소
		server_name xxx.xxx.com localhost;
		# 클라이언트가 접근 가능한 디렉토리
		root html;
		cgi .py python;
		# cgi .php php-cgi;
		limit_except GET

		location / {
			index index.html;
		}

		location /data {
			autoindex on;
			limit_except GET;
		}

		location /errors {
		}

		location /admin {
			auth admin:admin;
			index index.html;
	  }
	}
}

참고

nginx

[NGINX] 꼭 알아야 할 configuration 기초 개념!