반응형

안녕하세요. 가야태자 @talkit 입니다.

궁극적으로 하려고 하는 것은 Mattermost라는 Slack 대체 프로그램에 TLS 기반의 SSL을 도입하게 하는 것입니다.

그전에 NGINX를 잘 몰라서 설치해보고, SSL을 어떻게 구성하는지를 좀 알아보고 다시 Mattermost를 손을 대야 할 것 같습니다.

웹서버는?

웹서버는 간단하게 정의하자면 웹을 서비스하는 서버 입니다. 저희가 http 또는 https로 시작하는 주소를 입력하면 브라우져에서 여러 화면들을 확인하게 되는데, 그 주소에 웹서버가 있기 때문입니다.

그런데, 저는 Apache Web Server 주로 사용하는 사람입니다. 하지만, 그렇다고, 블로그에 아파치를 설치하는 방법을 적은 적이 없네요 ^^ 앞으로는 적도록 하겠습니다.

https://httpd.apache.org/

아파치 웹서버는 위 URL에서 정보를 확인하고 다운로드 할 수 있습니다.

물론 Ubuntu에서 기본 패키지로 제공하기 때문에 금방 설치할 수 있습니다.

이번에 적으려고 하는 NGINX도 웹서버의 일종입니다. Apache 보다는 좀 더 뒤에 나온 제품이어서 좀 더 신선한 기능들을 제공하긴 하지만, 서로 경쟁 관계여서 요즘은 NGINX가 좀 더 점유율을 가져가고 있다고 알고 있습니다. ^^ 서로를 보고 보완을 하고 있는 것으로 알고 있습니다.

W3Techs - extensive and reliable web technology surveys 출처 : https://w3techs.com/

위에서 보시다 싶이 NGIX가 1.1% 정도 우위를 점유하고 있습니다.

NGINX의 공식 웹사이트는 https://nginx.org/en/ 에서 확인할 수 있습니다.

우리는 우분투 리눅스에 오늘 NGINX를 설치할 것입니다. ^^

우분투 리눅스 설치.

리눅스/Linux VMWARE에 우분투/Ubuntu 20.04 설치하기/Install https://talkit.tistory.com/677

리눅스/Linux VMWARE에 우분투/Ubuntu 18.04 설치하기/Install https://talkit.tistory.com/637

위두 글을 이용해서 VMWARE에 리눅스를 설치 하십시오.

Putty 로 리눅스에 접속하기

[무료소프트웨어] 무료 보안쉘 클라이언트 PuTTY 최신 버전 다운로드 및 설치하기. How to Install the latest version PuTTY that is free Secure Shell Client. https://talkit.tistory.com/674

리눅스/Linux 오라클 VPS에 접속해보자. How to connect to free VPS on Oracle Cloud. https://talkit.tistory.com/673

리눅스/Linux SSH를 통해서 VMWARE Linux에 접속해보자. How to connect to Linux on VMWARE via SSH https://talkit.tistory.com/688

리눅스에 접속하시는 방법은 위 글들에서 설명해 두었습니다. 참고해서 접속하시면 될 것 같습니다.

리눅스에 NGINX 설치

저는 계속 Putty러 접속을 합니다.

여러분들이 VMWARE에 우분투를 설치하셨거나, 우분투 리눅스 VPS를 하나 가지고 계시거나 하다는 전제 하에서 이 글은 시작 하고 있습니다.

리눅스에 접속하기

서버에 우선 접속하십시오.

Putty를 여시고 저기 주소에 입력하시거나 아래에 있는 저장된 세션에서 선택해서 접속 하시면 됩니다.

login as: talkit
talkit@192.168.0.27's password:
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.15.0-56-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 updates can be applied immediately.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Thu Dec 29 23:51:08 2022 from 192.168.0.3
talkit@ubuntu:~$ ps -ef | grep nginx
talkit      2021    2007  0 23:50 pts/0    00:00:00 grep --color=auto nginx
talkit@ubuntu:~$

저는 잘 접속이 되었구요.

접속해서 ps로 nginx가 없는 것 까지 확인 했습니다. 제가 Mattermost를 설치하면서 nginx도 설치 했거든요 ^^

nginx 설치 이전으로 VMWARE파일을 돌려 놨습니다.

NGINX 설치하기

그 다음 과정을 계속 진행 하겠습니다.

sudo apt update

위 명령어는 옵셔널 이긴 하지만 한번씩 해주는 것이 좋습니다.

sudo apt install nginx

NGINX 설치는 정말 간단합니다. ^^

 sudo apt install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream
  nginx-common nginx-core
Suggested packages:
  fcgiwrap nginx-doc
The following NEW packages will be installed:
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream
  nginx nginx-common nginx-core
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 605 kB of archives.
After this operation, 2,141 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-common all 1.18.0-0ubuntu1.4                                                                                                                                                                                                                        [37.7 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-image-filter amd6                                                                                                                                                                                                                       4 1.18.0-0ubuntu1.4 [14.8 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-xslt-filter amd64                                                                                                                                                                                                                        1.18.0-0ubuntu1.4 [13.0 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-mail amd64 1.18.0-0ubu                                                                                                                                                                                                                       ntu1.4 [42.9 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-stream amd64 1.18.0-0u                                                                                                                                                                                                                       buntu1.4 [67.4 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-core amd64 1.18.0-0ubuntu1.4                                                                                                                                                                                                                        [425 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx all 1.18.0-0ubuntu1.4 [3,620                                                                                                                                                                                                                        B]
Fetched 605 kB in 2s (293 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 160070 files and directories currently installed.)
Preparing to unpack .../0-nginx-common_1.18.0-0ubuntu1.4_all.deb ...
Unpacking nginx-common (1.18.0-0ubuntu1.4) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../1-libnginx-mod-http-image-filter_1.18.0-0ubuntu1.4_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.18.0-0ubuntu1.4) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../2-libnginx-mod-http-xslt-filter_1.18.0-0ubuntu1.4_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.4) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../3-libnginx-mod-mail_1.18.0-0ubuntu1.4_amd64.deb ...
Unpacking libnginx-mod-mail (1.18.0-0ubuntu1.4) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../4-libnginx-mod-stream_1.18.0-0ubuntu1.4_amd64.deb ...
Unpacking libnginx-mod-stream (1.18.0-0ubuntu1.4) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../5-nginx-core_1.18.0-0ubuntu1.4_amd64.deb ...
Unpacking nginx-core (1.18.0-0ubuntu1.4) ...
Selecting previously unselected package nginx.
Preparing to unpack .../6-nginx_1.18.0-0ubuntu1.4_all.deb ...
Unpacking nginx (1.18.0-0ubuntu1.4) ...
Setting up nginx-common (1.18.0-0ubuntu1.4) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.                                                                                                                                                                                                                       service.
Setting up libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.4) ...
Setting up libnginx-mod-mail (1.18.0-0ubuntu1.4) ...
Setting up libnginx-mod-http-image-filter (1.18.0-0ubuntu1.4) ...
Setting up libnginx-mod-stream (1.18.0-0ubuntu1.4) ...
Setting up nginx-core (1.18.0-0ubuntu1.4) ...
Setting up nginx (1.18.0-0ubuntu1.4) ...
Processing triggers for systemd (245.4-4ubuntu3.19) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ufw (0.36-6ubuntu1) ...
talkit@ubuntu:~$

중간에 Y 한번만 눌러 주시면 됩니다.

 sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-12-31 23:56:28 PST; 51s ago
       Docs: man:nginx(8)
   Main PID: 2701 (nginx)
      Tasks: 17 (limit: 19071)
     Memory: 13.8M
     CGroup: /system.slice/nginx.service
             ├─2701 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─2702 nginx: worker process
             ├─2703 nginx: worker process
             ├─2704 nginx: worker process
             ├─2705 nginx: worker process
             ├─2706 nginx: worker process
             ├─2707 nginx: worker process
             ├─2708 nginx: worker process
             ├─2709 nginx: worker process
             ├─2710 nginx: worker process
             ├─2711 nginx: worker process
             ├─2712 nginx: worker process
             ├─2713 nginx: worker process
             ├─2714 nginx: worker process
             ├─2715 nginx: worker process
             ├─2716 nginx: worker process
             └─2717 nginx: worker process

Dec 31 23:56:28 ubuntu systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 31 23:56:28 ubuntu systemd[1]: Started A high performance web server and a reverse proxy server.

리눅스 서비스를 확인하면 이미 nginx가 활성화 되어 있는 상태 입니다. ^^

방화벽 설정 - 생략

방화벽 관련 설정도 있지만 방화벽 설정은 안해서 ^^

웹서버에 브라우져로 접속해 보기

웹서버가 켜져 있는걸 확인 했으니까 브라우져로 접속을 해보겠습니다.

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

잘 설치 되었다고 뜨네요 ^^

기본적으로 여기까지하면 웹서버가 설치 되었습니다. 

다음에는 웹서버의 웹 문서들을 어디에 놓을 건지에 대해서 말씀 드리겠습니다. 

감사합니다. 

 

 

반응형

+ Recent posts