Posted
Filed under 개발/하드웨어
나무위키 버터플라이 키보드 항목
https://namu.wiki/w/%EB%B2%84%ED%84%B0%ED%94%8C%EB%9D%BC%EC%9D%B4%20%ED%82%A4%EB%B3%B4%EB%93%9C

노트북을 얇게 만들기 위해 개발된 버터플라이 키보드는, 시간이 지나면서 키보드 속에 먼지가 지속적으로 유입되면 키가 잘 안눌리거나 두번눌리는 불량이 발생한다.

3세대에서는 이 문제에 대응하기 위해 키캡 하부에 실리콘막을 덮었는데 그럼에도 불구하고 불량문제가 발생했다.



이런 불량눌림 문제를 소프트적으로 해결하는 Unshaky 앱이 있다.
키 입력 사이에 딜레이를 설정하고 딜레이보다 빠르게 발생하는 입력은 무시하는 방식으로 해결한다.
https://github.com/aahung/Unshaky
2019/04/12 23:48 2019/04/12 23:48
Posted
Filed under 개발/Linux
Let's encrypt는 사용자에게 무료로 TLS 인증서를 발급해주는 비영리기관이다. 루트 도메인, 서브 도메인, 와일드카드 서브 도메인 등에 대한 인증서 발급이 가능하다.

발급된 인증서의 유효기간은 90일이며 만료 30일 전부터 갱신할 수 있으며 갱신가능 횟수는 무제한이다.

Let's encrypt가 인증서를 발급하는 방식에는 standalone, webroot, dns 세가지가 있는데 여기서는 webroot 명령어를 이용하여 발급한다.

webroot 명령어를 이용하면 자신의 웹서버에서 작동중인 http 프로토콜의 웹사이트에 certbot이 접속하여 서버가 유효한지 확인하고 인증서를 발급한다.

현재 Nginx에서 http://www.test.com이라는 웹사이트를 운영중이고 Nginx 설정은 다음과 같다고 하자.

[code]
server {
    listen 80;
    listen [::]:80;

    server_name www.test.com;

    root /var/www/html;
    index index.html index.htm index.php;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        }
}
[/code]


* certbot 패키지를 설치하고 인증서를 발급한다.
$ sudo apt-get install certbot
$ sudo certbot certonly --webroot --webroot-path=/var/www/html
-d www.test.com


* 발급받은 인증서는 /etc/letsencrypt/live/[인증서이름] 에 저장된다.
cert.pem - 인증서 파일
chain.pem - 인증서 발급자 파일
fullchain.pem - cert.pem 과 chain.pen 을 하나로 합쳐놓은 파일
privkey.pem - 인증암호를 해독하는 개인키

Apache2 서버에서는 cert.pem, chain.pem, privkey.pem 을,
Nginx 서버에서는 fullchain.pem, privkey.pem 을 사용한다.


* Nginx의 서버설정 변경
[code]
server {
    listen 80;
    listen [::]:80;

    server_name www.test.com;
   
    # 모든 http 요청을 https로 301 리다이렉트한다
    return 301 https://$server_name$request_uri;

    root /var/www/html;
    index index.html index.htm index.php;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        }
}


server {
    listen 443;
    listen [::]:443;

    server_name www.test.com;
    root /var/www/html;
    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    ssl                  on;
    ssl_certificate      /etc/letsencrypt/live/www.test.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/www.test.com/privkey.pem;
    ssl_ciphers  HIGH:!aNULL:!MD5;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    }
}
[/code]


* Nginx 서버 재시작
$ sudo systemctl restart nginx


* 발급받은 인증서 확인
$ sudo certbot certificates


* 인증서 갱신
$ sudo certbot renew


* 인증서 취소 및 삭제
$ certbot revoke --cert-path /etc/letsencrypt/live/www.test.com/cert.pem
$ sudo certbot delete --cert-name www.test.com
2019/04/12 13:43 2019/04/12 13:43
Posted
Filed under 개발/Linux
가상호스트(VirtualHost) 기능을 이용하면 하나의 IP로 복수개의 웹서버를 운용할 수 있다.

Nginx에서 가상호스트 이용하기 위해서는 /etc/nginx/nginx.conf 하단의 # Virtual Host Configs 블럭에 가상호스트 설정을 추가하면 된다. 하지만 이러면 가독성도 떨어지고 설정파일이 지저분해진다는 문제가 있으므로 이렇게 하진 않는다.

# Virtual Host Configs 블럭에는 include /etc/nginx/sites-enabled/*; 라는 내용이 있는데 이것이 가상호스트 설정파일을 외부에 따로 작성하여 nginx.conf에서 불러오기 위한 설정이다.

일반적으로는 가상호스트용 설정파일은 /etc/nginx/sites-available/에 작성한 뒤 /etc/nginx/sites-enabled/에 심볼릭링크를 작성하여 불러오는 방식을 사용한다.


*가상호스트 설정
test.com 이라는 도메인을 구입해 사용하고 있다고 가정한다.
도메인관리 사이트에서 작성하고 싶은 가상호스트의 도메인인 abc.test.com을 서버의 IP에 A레코드로 연결시킨다. 서버가 요청을 받았을 때 응답해줄 디렉토리는 /var/www/html/test/라 한다.


* 다음과 같이 파일을 작성한다.
$sudo nano /etc/nginx/sites-available/abc.test.com

[code]
server {
    listen 80;
    listen [::]:80;

    server_name abc.test.com;

    root /var/www/html/test;
    index index.htm index.html index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    }
}
[/code]


* sites-enabled에 심볼릭링크를 작성한다.
$ sudo ln -s /etc/nginx/sites-available/abc.test.com /etc/nginx/sites-enabled/abc.test.com


* 설정파일을 검사한 후, Nginx를 재시작한다
$ sudo nginx -t
$ sudo systemctl restart nginx
2019/04/11 14:16 2019/04/11 14:16