본문 바로가기
미들웨어/Nginx

Nginx compile 설치하기

by _Nate 2023. 4. 3.
반응형

Nginx는 오픈소스 WebServer 중 최근 Apache이상으로 사용량이 증가하고 있다.
Apache의 c10k 이슈를 해결하기 위해 개발되었으며 매우 가벼워 대용량 트래픽을 처리하는데 장점이 있다.
이번 포스팅에서는 compile을 통해 nginx 를 설치해 보겠다.


1. 필요한 패키지 설치

  • Nginx를 설치하기 위해 필요한 패키지들을 먼저 설치한다.
  • 어떤 모듈을 사용하느냐에 따라 구성옵션이 달라질 수 있으며 아래는 가장 평범한(?) 구성을 가이드한다.
yum -y install gcc pcre pcre-devel openssl openssl-devel zlib

 
2. nginx 다운로드

  • 기존 WEB서버 Nginx외에 최근 다양한 종류의 Nginx프로젝트가 진행되고 있다.
  • WEB서버용 Nginx를 아래 URL에서 다운로드 한다.
  • http://nginx.org/en/download.html
 

nginx: download

 

nginx.org

 
3. 설치

  • 다운로드한 tar.gz파일을 서버에 업로드하고 압축을 푼다.
  • configure를 할 때 다양한 옵션을 추가할 수 있으며 필요한 옵션들은 아래 URL에서 확인 가능하다.
  • http://nginx.org/en/docs/configure.html
 

Building nginx from Sources

Building nginx from Sources The build is configured using the configure command. It defines various aspects of the system, including the methods nginx is allowed to use for connection processing. At the end it creates a Makefile. The configure command supp

nginx.org

 

  • 평소 prefix와 https모듈만 추가하여 설치한다.
./configure --prefix=/home/web/nginx --with-http_ssl_module

make && make install
  • /home/web/nginx경로에 nginx를 설치하며 https 모듈을 기본적으로 로딩한다.

 

  • 아래와 같이 설치가 된것을 확인할 수 있다.
[test@localhost nginx]$ pwd
/home/web/nginx
[test@localhost nginx]$ ls -arlt
drwxr-xr-x.  2 test    test    19 Apr  3 05:22 sbin
drwxr-xr-x.  2 test    test    40 Apr  3 05:22 html
drwxr-xr-x.  2 test    test 16384 Apr  3 05:23 ssl
drwxr-xr-x.  2 test    test 16384 Apr  3 05:23 conf
drwx------.  2 nobody  test     6 Apr  3 05:23 uwsgi_temp
drwx------.  2 nobody  test     6 Apr  3 05:23 scgi_temp
drwx------.  2 nobody  test     6 Apr  3 05:23 proxy_temp
drwx------.  2 nobody  test     6 Apr  3 05:23 fastcgi_temp
drwx------.  2 nobody  test     6 Apr  3 05:23 client_body_temp
drwxr-xr-x.  2 test    test    41 Apr  3 05:24 logs

 

반응형

nginx 설치는 매우 간단하며 금방 끝난다.
다음 포스팅에서는 여러가지 설정을 추가해 보도록 하겠다.

반응형