728x90

To make sure that your visitors always will be using an secured connection to your website, you have to redirect visitors that are making the first connection via HTTP. Here we make use of the permanent HTTP redirect code (HTTP status 301).

The following steps describe the configuration of Nginx to have the website loaded completely over HTTPS. Please read our background information on Securing your complete website with SSL

Configuring HTTPS per website

To comply with the specs you should first redirect visitors entering via HTTP to HTTPS. We need to configure this per worker (website), the configuration file for your site probably sits in /etc/nginx/sites-available/.

 

server {
       listen         80;
       server_name    www.servercertificates.com;
       return         301 https://$server_name$request_uri;
}

Note that the server_name needs to be changed to your own domainname and the HTTPS version of your site is available, before creating the redirect.

728x90

Bot인 경우에 대비해서 이 차이를 정확히 명시해 주어야 합니다.(예를 들어, 웹 크롤러가 301을 반환받았다면 검색엔진의 Indexing된 주소를 수정할 것입니다.)

 

이 Redirection은 접속하려는 사용자에게 HTTPS를 통한 접속을 강제하려 할 때에도 유용하게 사용할 수 있습니다. 예를 들어, 다음과 같이 설정파일을 작성하면 http://tuwlab.com 으로 접속하려는 사용자를 https://tuwlab.com 으로 강제 Redirection 시킵니다.

?

server
{
    listen      80;
    server_name tuwlab.com;
    return 301 https://$server_name$request_uri;
}

 

뭐, 다음과 같이 스크립트를 통해서 수동으로 Redirection을 해 줄 수도 있지만,

?

<script>
    document.location.href = "{Redirection 주소}";
</script>

이 경우 페이지를 이동하는 과정에 사용에게 순간적으로 노출이 되고, 자바스크립트를 꺼 놓은 경우 흰색의 빈 화면만 달랑 표시되고 아무 일도 일어나지 않게 됩니다. 더 큰 문제점은 이런 식으로 Redirection을 하면 검색엔진에서 크롤링을 하지 않거나, 스팸 사이트로 분류할수도 있다는 점입니다.

따라서 이동된 페이지에 대해서는 HTTP Status Code를 사용해서 정확히 무슨 일이 일어났는지 Client측에 알려주도록 해야 합니다.

728x90

Linux SSL Trouble Shooting

[에러구문]

cannot load certificate key "/home/SSL/201810/key.pem": PEM_read_bio_PrivateKey() failed 

(SSL: error:0906406D:PEM routines:PEM_def_callback:problems getting password error:0906A068:PEM routines:PEM_do_header:bad password read)

 

[처리방법]

openssl rsa -in [기존인증서파일].key -out [새로운인증서파일].key

openssl 로 접근하게 되면 key에 대한 pass-phrase 를 물어본다. 이 경우 비밀번호를 넣었을 때 복호화에 성공하면 새로운 키를 -out 으로 생성하게 된다.

728x90

you can use

fuser -n tcp -k 9001

see more details in wikipedia

 

fuser (Unix) - Wikipedia

The Unix command fuser is used to show which processes are using a specified computer file, file system, or Unix socket. Example[edit] For example, to check process IDs and users accessing a USB drive: $ fuser -m -u /mnt/usb1 /mnt/usb1: 1347c(root) 1348c(g

en.wikipedia.org

 

 

fuser library 는 CentOS 에서는 이름이 다르다. 없다면 psmisc 로 package 를 설치하자

+ Recent posts