웹사이트 검색

Nginx로 Wekan Kanban을 설치하고 Debian 10에서 SSL을 암호화하는 방법


이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. Wekan 설치
  4. Wekan 및 MongoDB 서비스 관리
  5. Nginx를 역방향 프록시로 구성\n
  6. Lets Encrypt Free SSL로 보안 Wekan
  7. Wekan 웹 인터페이스 액세스

Wekan은 Meteor JavaScript 프레임워크로 구축된 무료 오픈 소스 Kanban 보드이며 MIT 라이선스에 따라 배포됩니다. Workflowy 및 Trello와 매우 유사하여 일상적인 작업을 관리하고, 할 일 목록을 준비하고, 다른 사람을 관리하는 등의 작업을 할 수 있습니다. 완벽하게 반응하는 웹 인터페이스가 제공되며 여러 언어로 번역됩니다. Wekan은 Wekan 보드 내보내기, Trello 보드 가져오기, SMTP 설정, 보관된 보드 복원, 사용자 관리 모듈, 끌어서 놓기 기능 등을 포함한 다양한 기능을 제공합니다.

이 튜토리얼에서는 Debian 10에서 Nginx를 프록시 서버로 사용하여 Wekan Kanban 보드를 설치하는 방법을 보여줍니다.

전제 조건

  • Debian 10을 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 서버에 루트 암호가 구성되어 있습니다.\n

시작하기

시작하기 전에 다음 명령을 사용하여 서버를 최신 버전으로 업데이트하는 것이 좋습니다.

apt-get update -y
apt-get upgrade -y

서버가 업데이트되면 다시 시작하여 변경 사항을 적용하십시오.

웨칸 설치

Debian 10에 Wekan을 설치하는 가장 쉬운 방법은 스냅을 사용하는 것입니다. 기본적으로 스냅 패키지는 Debian 10 리포지토리에서 사용할 수 있습니다. 다음 명령을 실행하여 설치할 수 있습니다.

apt-get install snapd -y

스냅이 시작/중단되면 다음 명령을 실행하여 Wekan을 설치할 수 있습니다.

snap install wekan

Wekan이 설치되면 Wekan 및 Mongodb 서비스가 자동으로 시작됩니다.

다음 명령을 사용하여 Wekan 서비스의 상태를 볼 수 있습니다.

systemctl status snap.wekan.wekan

다음 출력이 표시되어야 합니다.

? snap.wekan.wekan.service - Service for snap application wekan.wekan
   Loaded: loaded (/etc/systemd/system/snap.wekan.wekan.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-12-22 07:43:34 UTC; 7s ago
 Main PID: 7836 (wekan-control)
    Tasks: 11 (limit: 2359)
   Memory: 156.3M
   CGroup: /system.slice/snap.wekan.wekan.service
           ??7836 /bin/bash /snap/wekan/678/bin/wekan-control
           ??8522 /snap/wekan/678/bin/node main.js

Dec 22 07:43:35 debian10 wekan.wekan[7836]: HEADER_LOGIN_EMAIL=Header login email. Example for siteminder: HEADEREMAILADDRESS (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: LOGOUT_WITH_TIMER=false (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: LOGOUT_IN= (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: LOGOUT_ON_HOURS= (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: LOGOUT_ON_MINUTES= (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: DEFAULT_AUTHENTICATION_METHOD= (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: ATTACHMENTS_STORE_PATH= (default value)
Dec 22 07:43:35 debian10 wekan.wekan[7836]: MONGO_URL=mongodb://127.0.0.1:27019/wekan
Dec 22 07:43:37 debian10 wekan.wekan[7836]: Presence started serverId=ijqY8RbEWv8Hg9RSb
Dec 22 07:43:38 debian10 wekan.wekan[7836]: Meteor APM: completed instrumenting the app

기본적으로 Wekan은 포트 8080에서 실행됩니다. Wekan 포트를 3001로 변경하려면 다음 명령을 실행하십시오.

snap set wekan port='3001'

다음으로 Wekan 및 MongoDB 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart snap.wekan.mongodb
systemctl restart snap.wekan.wekan

Wekan 및 MongoDB 서비스 관리

Wekan 서비스를 시작 및 중지하려면 다음 명령을 실행하십시오.

systemctl stop snap.wekan.wekan
systemctl start snap.wekan.wekan

MongoDB 서비스를 시작하고 중지하려면 다음 명령을 실행합니다.

systemctl stop snap.wekan.mongodb
systemctl start snap.wekan.mongodb

Nginx를 역방향 프록시로 구성

이제 Wekan이 설치되어 포트 3001에서 수신 대기합니다. 다음으로 Nginx 프록시 뒤에서 Wekan을 실행하는 것이 좋습니다.

이렇게 하려면 먼저 다음 명령을 사용하여 Nginx 웹 서버를 설치합니다.

apt-get install nginx -y

설치가 완료되면 /etc/nginx/nginx.conf 파일을 열고 hash_bucket_size를 설정합니다.

nano /etc/nginx/nginx.conf

다음 줄의 주석 처리를 제거하십시오.

        server_names_hash_bucket_size 64;

완료되면 파일을 저장하고 닫습니다. 그런 다음 Nginx 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart nginx

다음으로 아래와 같이 Wekan용 Nginx 가상 호스트 파일을 만듭니다.

nano /etc/nginx/conf.d/wekan.conf

다음 줄을 추가합니다.

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}
server {
    listen 80;
    server_name wekan.linuxbuz.com;
    if ($http_user_agent ~ "MSIE" ) {
        return 303 https://browser-update.org/update.html;
    }
    location / {
        proxy_pass http://127.0.0.1:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade; # allow websockets
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
    }
}

완료되면 파일을 저장하고 닫습니다. 그런 다음 다음 명령을 사용하여 Nginx에서 구문 오류가 있는지 확인합니다.

nginx -t

다음 출력이 표시되어야 합니다.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

마지막으로 Nginx 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart nginx

이 시점에서 Nginx는 요청을 Wekan 포트 3001로 전달하도록 구성됩니다.

Lets Encrypt Free SSL로 보안 Wekan

다음으로 Lets Encrypt 무료 SSL로 Wekan을 보호하는 것이 좋습니다. 이렇게 하려면 서버에 Certbot 클라이언트를 설치해야 합니다. Certbot은 무료 SSL을 다운로드하고 이 인증서를 사용하도록 Nginx를 구성하는 데 사용할 수 있는 Lets Encrypt 클라이언트입니다.

기본적으로 최신 버전의 Certbot은 Debian 10 기본 리포지토리에서 사용할 수 없습니다. 따라서 서버에 Certbot 리포지토리를 추가해야 합니다.

다음 명령을 사용하여 저장소를 추가할 수 있습니다.

echo "deb http://ftp.debian.org/debian buster-backports main" >> /etc/apt/sources.list

다음으로 다음 명령을 사용하여 리포지토리를 업데이트하고 Certbot 클라이언트를 설치합니다.

apt-get update -y
apt-get install python-certbot-nginx -t buster-backports

설치가 완료되면 다음 명령을 실행하여 도메인에 대한 SSL 인증서를 가져와 설치합니다.

certbot --nginx -d wekan.linuxbuz.com

아래와 같이 이메일 주소를 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for wekan.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/wekan.conf

다음으로 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택해야 합니다.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2를 입력하고 Enter 키를 눌러 설치 프로세스를 시작합니다. 설치가 완료되면 다음과 같은 결과가 표시되어야 합니다.

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/wekan.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://wekan.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=wekan.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/wekan.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/wekan.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-03-25. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Wekan 웹 인터페이스에 액세스

이제 웹 브라우저를 열고 URL https://wekan.linuxbuz.com을 입력하십시오. 다음 페이지로 리디렉션됩니다.

등록 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

원하는 사용자 이름, 비밀번호, 이메일을 제공하고 등록 버튼을 클릭합니다. 다음으로 로그인 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

사용자 이름, 비밀번호를 입력하고 로그인 버튼을 클릭합니다. 다음 페이지에서 Wekan 대시보드를 볼 수 있습니다.

지금은 그게 다야. Debian 10 서버에 Wekan Kanban을 성공적으로 설치하고 무료 SSL을 Lets Encrypt로 보호했습니다.