stable한 버전으로 업그레이드 하고 싶은데 yum install nginx==1.22.1
하니깐 없다고 떴다.
그래가지고 설치하는 방법 좀 찾았는데 간단하다.
# vi /etc/yum.repos.d/nginx.repo 로 새로운 파일을 만들어준다.
[nginx]
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를 새로운 버전으로 설치했었는데 기본 nginx.conf
파일이 초기화 되는 과정을 겪었습니다. 열심히 설정해놓은 파일이 초기화 될 수 있으니 파일은 꼭 백업해두자.
- nginx.conf
- *.conf로 설정한 파일 (reverse proxy)
이전 버전과 호환성 문제로 얽힐 수 있으니 기존 버전을 삭제하고 새로운 버전을 다시 설치해줍니다.
yum remove nginx
기본적으로 nginx 설치하게 되면 가장 최신의 mainline 버전으로 다운받아지게 된다. 만약 특정 버전이 필요하다면 다음과 같이 버전을 확인한 후 특정 버전을 명시해 다운받아주면 됩니다.
yum install nginx
다음의 명령어를 입력하게 되면 yum으로 설치 가능한 nginx 버전이 몽땅 나오게 됩니다.
yum --showduplicates list nginx
yum install nginx-1.23.4-1.el8.ngx
백업해놨던 파일들로 덮어 씌어줍니다.
# vi /etc/yum.repos.d/nginx.repo 로 새로운 파일을 만들어준다.
[nginx]
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를 새로운 버전으로 설치했었는데 기본 nginx.conf
파일이 초기화 되는 과정을 겪었습니다. 열심히 설정해놓은 파일이 초기화 될 수 있으니 파일은 꼭 백업해두자.
- nginx.conf
- *.conf로 설정한 파일 (reverse proxy)
이전 버전과 호환성 문제로 얽힐 수 있으니 기존 버전을 삭제하고 새로운 버전을 다시 설치해줍니다.
yum remove nginx
yum install nginx
백업해놨던 파일들로 덮어 씌어주고 conf 파일도 이동시켜줍니다.
이전에 <프로젝트 명>.conf
파일을 백업해두고 nginx 설치후 백업 파일을 옮겨주었는데, 해당 부분에는 default로 default.conf 파일이 존재했습니다. 그래서 해당 프로젝트 명으로 된 파일로 전달되는 것이 아니라 default conf 파일로 전달되어 잠시나마 고민했던 적이 있으니 이 부분 참고해주세용~
그럼 끗!
참고자료 📩
Oh wow, this guide was such a lifesaver for me! I was struggling with updating to the latest mainline version of NGINX and wasn’t sure how to handle the repo setup and backup process properly. The step-by-step explanation here, especially about backing up
nginx.conf
and other custom.conf
files, saved me from potentially losing hours of work.I had a moment of panic when my custom reverse proxy
.conf
file didn’t load properly after reinstalling NGINX, but after carefully moving my backup as described here, everything worked perfectly. It’s also super helpful that this guide covers both mainline and stable versions with clear instructions.For anyone using Rocky Linux and setting up NGINX, I’d recommend checking out this detailed guide: Install Nginx on Rocky Linux 9. It really helped me get everything running smoothly. Thanks a ton for sharing this!