ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • nginx 설치
    nginx 2021. 12. 27. 23:24

    /home/windbird/opt/nginx-1.20.2 에 nginx-1.20.2 버전을 설치한다.

    설치 파일 다운로드

    http://nginx.org/en/download.html 에서 nginx-1.20.2 버전 다운로드

    mkdir -p /tmp/nginx_install
    cd /tmp/nginx_install
    wget http://nginx.org/download/nginx-1.20.2.tar.gz
    tar xvfz nginx-1.20.2.tar.gz
    cd nginx-1.20.2/

    pcre 설치

    http_rewrite_module 이 default 로 설치되기 위해서는 pcre 가 미리 설치되어 있어야 한다.

    sudo apt-get update
    sudo apt-get install libpcre3 libpcre3-dev

    컴파일 환경 설정 및 설치

    # ./configure --help
    
    ./configure \
      --prefix=/home/windbird/opt/nginx-1.20.2 \
      --user=windbird \
      --group=windbird \
      --error-log-path=/home/windbird/opt/nginx-1.20.2/logs/error.log \
      --http-log-path=/home/windbird/opt/nginx-1.20.2/logs/access.log \
      --without-http_scgi_module \
      --without-http_uwsgi_module \
      --without-http_fastcgi_module \
      --with-stream
      
      make
      make install

    80 port 로 실행할 권한 주기

    sudo /usr/sbin/setcap 'cap_net_bind_service=+ep' /home/windbird/opt/nginx-1.20.2/sbin/nginx

    nginx.conf 작성하기

    /home/windbird/opt/nginx-1.20.2/conf/nginx.conf 를 필요에 맞게 수정

    nginx 실행하기

    sbin/nginx
    
    # sbin/nginx -s reload
    # sbin/nginx -s stop

    nginx logrotate 하기

    nginx log 파일 정리 스크립트 활용

    이미 설치된 nginx 의 컴파일 환경 확인하기

    windbird@AL01929730:~/opt/nginx-1.20.2$ sbin/nginx -V
    nginx version: nginx/1.20.2
    built by gcc 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
    configure arguments: --prefix=/home/windbird/opt/nginx-1.20.2 --user=windbird --group=windbird --error-log-path=/home/windbird/opt/nginx-1.20.2/logs/error.log --http-log-path=/home/windbird/opt/nginx-1.20.2/logs/access.log --without-http_rewrite_module --without-http_scgi_module --without-http_uwsgi_module --without-http_fastcgi_module --with-stream

    'nginx' 카테고리의 다른 글

    nginx log 파일 정리 스크립트  (0) 2021.12.09

    댓글

Designed by Tistory.