inblog logo
|
tubeblog

    Nginx 설치하기

    ubuntu 20.04에서 nginx 설치하기
    Jun 29, 2023
    Nginx 설치하기
    Contents
    Nginx 설치하기서비스 환경Nginx 설치Nginx 업그레이드Nginx 실행
    Nginx 설치하기서비스 환경Nginx 설치Nginx 업그레이드리포지토리 키 추가리포지토리 추가Nginx 업그레이드Nginx 실행Nginx 실행테스트 페이지 접속

    Nginx 설치하기

    서비스 환경

    • Ubuntu 20.04
    • NginX

    Nginx 설치

    sudo apt install nginx nginx -v nginx version: nginx/1.18.0 (Ubuntu)
     

    Nginx 업그레이드

    현재 apt의 리포지토리에 제공되는 버전은 수준이 낮은 버전이다. Nginx를 업데이트 시켜줘야한다.

    리포지토리 키 추가

    $ sudo wget https://nginx.org/keys/nginx_signing.key --2021-06-22 10:15:10-- https://nginx.org/keys/nginx_signing.key Resolving nginx.org (nginx.org)... 3.125.197.172, 52.58.199.22, 2a05:d014:edb:5704::6, ... Connecting to nginx.org (nginx.org)|3.125.197.172|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1561 (1.5K) [application/octet-stream] Saving to: ‘nginx_signing.key’ nginx_signing.key 100%[===============================================================================================>] 1.52K --.-KB/s in 0s 2021-06-22 10:15:11 (128 MB/s) - ‘nginx_signing.key’ saved [1561/1561] $ sudo apt-key add nginx_signing.key OK
     

    리포지토리 추가

    /etc/apt/sources.list 에 저장소에 추가 해줍니다.
    deb https://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx deb-src https://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx
    <CODENAME>은 Ubuntu의 릴리스 코드 네임으로 수정해줍니다. 여긴 20.04이니 focal로 수정합니다.
     

    Nginx 업그레이드

    리포지토리를 추가해줫으니 리포지토리를 업데이트하고 설치해줍니다.
    $ sudo apt update $ sudo apt install nginx $ nginx -v nginx version: nginx/1.18.0 (Ubuntu)
     

    Nginx 실행

    Nginx 를 실행시키고 테스트 페이지 접속을 해보겠습니다.

    Nginx 실행

    $ sudo nginx
     

    테스트 페이지 접속

    $ curl -l 127.0.0.1 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
    Share article
    Contents
    Nginx 설치하기서비스 환경Nginx 설치Nginx 업그레이드Nginx 실행

    tubeblog

    RSS·Powered by Inblog