[Nginx] Ubuntu 22.04에서 Nginx 설치 및 관련 에러 해결

2024. 12. 31. 05:45·Backend/Nginx

 

0. 서버환경 (2024년 12월 현재)

- 네이버 클라우드(NCP) VPC 서버

- Ubuntu 22.04

 

1. Nginx설치 시 에러 처리 순서

(1) 아래와 같이 ngix를 설치할때 에러 발생

sudo apt update
sudo apt install nginx

 

(2) 발생된 에러 메세지

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nginx is already the newest version (1.18.0-6ubuntu14.5).
0 upgraded, 0 newly installed, 0 to remove and 171 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nginx-core (1.18.0-6ubuntu14.5) ...

Progress: [  0%] [................................................................................................................................................................................................................] 
Job for nginx.service failed because the control process exited with error code...................................................................................................................................................] 
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
invoke-rc.d: initscript nginx, action "start" failed.
× nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2024-12-30 22:34:03 KST; 5ms ago
       Docs: man:nginx(8)
    Process: 19643 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 10ms

Dec 30 22:34:03 dentpano1-lb systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 30 22:34:03 dentpano1-lb nginx[19643]: nginx: [emerg] socket() [::]:80 failed (97: Unknown error)
Dec 30 22:34:03 dentpano1-lb nginx[19643]: nginx: configuration file /etc/nginx/nginx.conf test failed
Dec 30 22:34:03 dentpano1-lb systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Dec 30 22:34:03 dentpano1-lb systemd[1]: nginx.service: Failed with result 'exit-code'.
Dec 30 22:34:03 dentpano1-lb systemd[1]: Failed to start A high performance web server and a reverse proxy server.
dpkg: error processing package nginx-core (--configure):
 installed nginx-core package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (<< 1.18.0-6ubuntu14.5.1~) | nginx-full (<< 1.18.0-6ubuntu14.5.1~) | nginx-light (<< 1.18.0-6ubuntu14.5.1~) | nginx-extras (<< 1.18.0-6ubuntu14.5.1~); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-core (>= 1.18.0-6ubuntu14.5) | nginx-full (>= 1.18.0-6ubuntu14.5) | nginx-light (>= 1.18.0-6ubuntu14.5) | nginx-extras (>= 1.18.0-6ubuntu14.5); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 nginx-core
 nginx
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

 

(3) dependency 에러로 추정되어 기존 설치된 것 삭제

apt-get remove --purge nginx nginx-full nginx-common

 

(4) 로그아웃 

exit

 

(5) 다시 로그인 후 root 폴더로 이동 후 다시 업데이트 및 재설치

cd ~
sudo apt update
sudo apt install nginx

 

(6) 다시 에러 발생 - 이번엔 80 포트 에러

 

2. Nginx 설치 시 [::]:80 에러 발생 처리

 

/etc/nginx/sites-enabled/default 파일을 열어서 아래과 같이 listen [::]:80 default_server 부분을 주석처리

 

이후 아래와 같이 재설치 시 별다른 에러 없이 설치가 되는것이 확인 되었다

sudo apt install nginx

 

 

3. Nginx 실행

systemctl restart nginx
systemctl status nginx

저작자표시 (새창열림)

'Backend > Nginx' 카테고리의 다른 글

[Nginx] NCP에 Nginx + Certbot + Let's encrypt를 이용한 Https 서비스 구성  (0) 2024.12.31
'Backend/Nginx' 카테고리의 다른 글
  • [Nginx] NCP에 Nginx + Certbot + Let's encrypt를 이용한 Https 서비스 구성
써니의 연습장
써니의 연습장
IT, AI, 일상, 경제 등..
  • 써니의 연습장
    써니의 연습장
    써니의 연습장
  • 전체
    오늘
    어제
    • 분류 전체보기 (25)
      • AI (3)
      • Streamlit (4)
      • Python (7)
        • Pandas (0)
        • Tensorflow (1)
        • Etc (6)
      • DataBase (5)
        • PostgreSql (5)
      • Backend (5)
        • Ubuntu (1)
        • Nginx (2)
        • Node.js (2)
      • Git (1)
  • 블로그 메뉴

    • 홈
    • AI
    • Streamlit
    • Python
    • DataBase
    • Backend
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    Github #Clone
    cudart64_110.dll
    python3.12
    Streamlit
    centos7
    Python
    ncp
    python3.10
    nginx
    Python #Pillow
    ubuntu22.4
    ubuntu
    cvat
    protoc #protocolbuffers
    ubuntu #port forwarding #우분투 #포트 포워딩
    Lets Encrypt
    PostgreSQL
    theme
    certbot
    PIP
    sam
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
써니의 연습장
[Nginx] Ubuntu 22.04에서 Nginx 설치 및 관련 에러 해결
상단으로

티스토리툴바