본문 바로가기

리눅스

[NGINX] NGINX 최신(안정 버전) 버전 설치하기

728x90

NGINX 최신(안정 버전) 버전 설치하기

nginx : High performance web server

http://nginx.org/en/linux_packages.html#RHEL-CentOS

EPEL 및 YUM Utilities 패키지 설치

yum install -y epel-release yum-utils

$ yum install -y epel-release yum-utils

nginx.repo 파일 생성

[nginx-stable]
...

baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
baseurl=https://nginx.org/packages/centos/$releasever/$basearch/
[nginx-mainline]

...

baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
baseurl=https://nginx.org/packages/mainline/centos/$releasever/$basearch/

$ vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=https://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=https://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

nginx-stable 저장소를 활성화

yum-config-manager --enable nginx-stable

$ yum-config-manager --enable nginx-stable

설치전 nginx 버전 확인

$ yum info nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: nrt.edge.kernel.org
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Available Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.21.1
Release     : 1.el7.ngx
Size        : 790 k
Repo        : nginx-mainline/7/x86_64
Summary     : High performance web server
URL         : https://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

nginx 설치

yum install -y nginx

$ yum install -y nginx

nginx 버전 확인

nginx -v

$ nginx -v
nginx version: nginx/1.21.4

nginx 서비스를 시작하고 부팅 시 자동으로 시작하도록 활성화

systemctl --now enable nginx

$ systemctl --now enable nginx

nginx 버전 정보 숨기기

nginx.conf 편집

$ vim /etc/nginx/nginx.conf
http {
...
    server_tokens off;
...
}
728x90