SSL 인증서 무료로 발급 받는 방법



letsencrypt.org 에서 공인발급되는 인증서입니다.


리눅스에 letsencrypt 를 설치해서 수동으로 발급이 가능합니다.


아쉬운 점이 유효기간이 3개월이고, 멀티도메인으로 발급이 안된다는 점입니다.


그리고 renew 옵션을 사용해서 갱신하면 됩니다.


startssl.com 에서 발급 받다가 포기하고 찾은건데 괜찮네요~



테스트 환경은 CentOS 7.x 에 Apache 입니다.



▶ letsencrypt 설치


# yum install letsencrypt



▶ 인증서 발급


# letsencrypt certonly --standalone -d conoha.ivps.kr


아래 처럼 명령어를 실행하면 이메일과 동의를 묻지 않고 진행이 됩니다.


# letsencrypt certonly --standalone --agree-tos -m 메일주소 -d 도메인명



SSL 인증서 무료로 발급 받는 방법SSL 인증서 무료로 발급 받는 방법


이메일을 입력합니다.



SSL 인증서 무료로 발급 받는 방법SSL 인증서 무료로 발급 받는 방법


동의를 합니다.



SSL 인증서 무료로 발급 받는 방법SSL 인증서 무료로 발급 받는 방법


httpd 데몬을 멈춰야 발급이 되나봅니다.


systemctl stop httpd


다시 발급을 시도하면 아래 화면 처럼 발급이 금방됩니다.



SSL 인증서 무료로 발급 받는 방법SSL 인증서 무료로 발급 받는 방법



▶ 인증서 갱신 방법


# letsencrypt renew



아래에서 아파치에서 인증서 설정 방법에 대해서 알아봅시다.


https://ivps.tistory.com/189


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

CentOS 7.x OpenSSL 개인인증키 발급 및 아파치 구축



https 443 포트를 이용하기 위해서는 인증키가 필요한데 개인테스트용 개발서버라면 자체 서버에서 개인키를 생성해서 이용하면 됩니다.


크롬브라우저에서 안전하지 않는 인증키라고 나오긴 하지만 무시하고 진행하면 됩니다.


CentOS 7.x 버전이라면 openssl 은 기본적으로 설치가 되어 있을겁니다.



▶ mod_ssl 설치


# yum install mod_ssl



▶ key 생성


[root@conoha-jp ~]# openssl genrsa -out ivps.kr.key 2048

Generating RSA private key, 2048 bit long modulus

..............................................................+++

......+++

e is 65537 (0x10001)



▶ csr 생성


[root@conoha-jp ~]# openssl req -new -key ivps.kr.key -out ivps.kr.csr

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [XX]:KR

State or Province Name (full name) []:Seoul

Locality Name (eg, city) [Default City]:Seoul

Organization Name (eg, company) [Default Company Ltd]:myServer

Organizational Unit Name (eg, section) []:

Common Name (eg, your name or your server's hostname) []:ivps.kr

Email Address []:ivps@ivps.kr


Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

콜론(:) 뒤에 문자열이 없는 건 아무것도 입력하지 않고 엔터를 의미합니다.



▶ crt 생성


[root@conoha-jp ~]# openssl x509 -req -days 365 -in ivps.kr.csr -signkey ivps.kr.key -out ivps.kr.crt

Signature ok

subject=/C=KR/ST=Seoul/L=Seoul/O=myServer/CN=ivps.kr/emailAddress=ivps@ivps.kr

Getting Private key



▶ 퍼미션 변경


# chmod 600 ivps.kr.*



▶ 인증키 복사 ( 위에서 생성된 파일을 인증키폴더로 복사를 합니다. )


[root@conoha-jp ~]# cp ivps.kr.* /etc/httpd/conf.d/



▶ 가상서버 443 포트 설정


[root@conoha-jp ~]# vi /etc/httpd/conf.d/ivps.kr.conf

<VirtualHost ivps.kr:443>

    SSLEngine On

    SSLCertificateFile /etc/httpd/conf.d/ivps.kr.crt

    SSLCertificateKeyFile /etc/httpd/conf.d/ivps.kr.key

    ServerName ivps.kr

    DocumentRoot /var/www/html

    ErrorLog logs/ivps.kr_error_log

    CustomLog logs/ivps.kr_access_log common

</VirtualHost>



▶ 아파치 재시작


# systemctl restart httpd



이제 브라우저에서 확인을 하면 됩니다.



letsencrtyp 무료 SSL 인증서 발급 받기는 여기를 https://ivps.tistory.com/188 참고하세요.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

phpMyAdmin import 파일 용량 변경




phpMyAdmin 에서 import 할때 업로드 용량이 default 값이 2MByte 로 되어 있다면 상향 조절을 하면 됩니다.


phpMyAdmin import 파일 용량 변경phpMyAdmin import 파일 용량 변경



vi /etc/php.ini 로 아래 두 변수를 변경하면 됩니다.


upload_max_filesize = 20M

post_max_size = 20M


저장 한 다음에 systemctl restart httpd


phpMyAdmin import 파일 용량 변경phpMyAdmin import 파일 용량 변경


이제 20메가로 변경된 것을 확인 할 수 있습니다.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

phpMyAdmin Alias 경로 변경



맨 아래는 아파치 로그인데 엄청나게 많이 들이대네요~


phpMyAdmin 설치 사용자라면 접근 경로를 아무래도 바꿔주는게 보안상 좋을 것 같습니다~



vi /etc/httpd/conf.d/phpMyAdmin.conf


Alias /phpMyAdmin /usr/share/phpMyAdmin

Alias /phpmyadmin /usr/share/phpMyAdmin


위 두개의 Alias 를 다른 이름으로 바꿔주시면 됩니다.


바꾼 다음에 systemctl restart httpd


/MyAdmin/scripts/setup.php: 1 Time(s)

/PMA/: 1 Time(s)

/PMA2005/: 1 Time(s)

/SQLite/main.php: 1 Time(s)

/SQLiteManager-1.2.4/main.php: 1 Time(s)

/SQLiteManager/main.php: 1 Time(s)

/SQlite/main.php: 1 Time(s)

/_phpmyadmin/scripts/setup.php: 1 Time(s)

/admin/: 1 Time(s)

/admin/phpmyadmin/scripts/setup.php: 1 Time(s)

/admin/pma/scripts/setup.php: 1 Time(s)

/admin/scripts/setup.php: 1 Time(s)

/agSearch/SQlite/main.php: 1 Time(s)

/db/scripts/setup.php: 1 Time(s)

/dbadmin/: 1 Time(s)

/dbadmin/scripts/setup.php: 1 Time(s)

/myadmin/: 1 Time(s)

/myadmin/scripts/setup.php: 1 Time(s)

/mysql-admin/: 1 Time(s)

/mysql/: 1 Time(s)

/mysql/scripts/setup.php: 1 Time(s)

/mysqladmin/: 1 Time(s)

/mysqladmin/scripts/setup.php: 1 Time(s)

/mysqlmanager/: 1 Time(s)

/openserver/phpmyadmin/: 1 Time(s)

/p/m/a/: 1 Time(s)

/php-my-admin/: 1 Time(s)

/php-myadmin/: 1 Time(s)

/phpMyAdmin-2.2.3/: 1 Time(s)

/phpMyAdmin-2.2.6/: 1 Time(s)

/phpMyAdmin-2.5.1/: 1 Time(s)

/phpMyAdmin-2.5.4/: 1 Time(s)

/phpMyAdmin-2.5.5-pl1/: 1 Time(s)

/phpMyAdmin-2.5.5-rc1/: 1 Time(s)

/phpMyAdmin-2.5.5-rc2/: 1 Time(s)

/phpMyAdmin-2.5.5/: 1 Time(s)

/phpMyAdmin-2.5.6-rc1/: 1 Time(s)

/phpMyAdmin-2.5.6-rc2/: 1 Time(s)

/phpMyAdmin-2.5.6/: 1 Time(s)

/phpMyAdmin-2.5.7-pl1/: 1 Time(s)

/phpMyAdmin-2.5.7/: 1 Time(s)

/phpMyAdmin-2.6.0-alpha/: 1 Time(s)

/phpMyAdmin-2.6.0-alpha2/: 1 Time(s)

/phpMyAdmin-2.6.0-beta1/: 1 Time(s)

/phpMyAdmin-2.6.0-beta2/: 1 Time(s)

/phpMyAdmin-2.6.0-pl1/: 1 Time(s)

/phpMyAdmin-2.6.0-pl2/: 1 Time(s)

/phpMyAdmin-2.6.0-pl3/: 1 Time(s)

/phpMyAdmin-2.6.0-rc1/: 1 Time(s)

/phpMyAdmin-2.6.0-rc2/: 1 Time(s)

/phpMyAdmin-2.6.0-rc3/: 1 Time(s)

/phpMyAdmin-2.6.0/: 1 Time(s)

/phpMyAdmin-2.6.1-pl1/: 1 Time(s)

/phpMyAdmin-2.6.1-pl2/: 1 Time(s)

/phpMyAdmin-2.6.1-pl3/: 1 Time(s)

/phpMyAdmin-2.6.1-rc1/: 1 Time(s)

/phpMyAdmin-2.6.1-rc2/: 1 Time(s)

/phpMyAdmin-2.6.1/: 1 Time(s)

/phpMyAdmin-2.6.2-beta1/: 1 Time(s)

/phpMyAdmin-2.6.2-pl1/: 1 Time(s)

/phpMyAdmin-2.6.2-rc1/: 2 Time(s)

/phpMyAdmin-2.6.2/: 1 Time(s)

/phpMyAdmin-2.6.3-pl1/: 1 Time(s)

/phpMyAdmin-2.6.3-rc1/: 1 Time(s)

/phpMyAdmin-2.6.3/: 2 Time(s)

/phpMyAdmin-2.6.4-pl1/: 1 Time(s)

/phpMyAdmin-2.6.4-pl2/: 1 Time(s)

/phpMyAdmin-2.6.4-pl3/: 1 Time(s)

/phpMyAdmin-2.6.4-pl4/: 1 Time(s)

/phpMyAdmin-2.6.4-rc1/: 1 Time(s)

/phpMyAdmin-2.6.4/: 1 Time(s)

/phpMyAdmin-2.7.0-beta1/: 1 Time(s)

/phpMyAdmin-2.7.0-pl1/: 1 Time(s)

/phpMyAdmin-2.7.0-pl2/: 1 Time(s)

/phpMyAdmin-2.7.0-rc1/: 1 Time(s)

/phpMyAdmin-2.7.0/: 1 Time(s)

/phpMyAdmin-2.8.0-beta1/: 1 Time(s)

/phpMyAdmin-2.8.0-rc1/: 1 Time(s)

/phpMyAdmin-2.8.0-rc2/: 1 Time(s)

/phpMyAdmin-2.8.0.1/: 1 Time(s)

/phpMyAdmin-2.8.0.2/: 1 Time(s)

/phpMyAdmin-2.8.0.3/: 1 Time(s)

/phpMyAdmin-2.8.0.4/: 1 Time(s)

/phpMyAdmin-2.8.0/: 1 Time(s)

/phpMyAdmin-2.8.1-rc1/: 1 Time(s)

/phpMyAdmin-2.8.1/: 1 Time(s)

/phpMyAdmin-2.8.2/: 1 Time(s)

/phpMyAdmin-2/: 1 Time(s)

/phpMyAdmin/: 1 Time(s)

/phpMyAdmin/scripts/setup.php: 1 Time(s)

/phpMyAdmin2/: 1 Time(s)

/phpadmin/scripts/setup.php: 1 Time(s)

/phpmanager/: 1 Time(s)

/phpmy-admin/: 1 Time(s)

/phpmyadmin/: 1 Time(s)

/phpmyadmin/scripts/setup.php: 1 Time(s)

/phpmyadmin2/: 1 Time(s)

/pma/: 1 Time(s)

/pma/scripts/setup.php: 1 Time(s)

/pma2005/: 1 Time(s)



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

리눅스 파일 시간 정보 확인



파일의 접근시간 및 수정시간, 그리고 변경시간을 확인하는 명령어 stat 입니다.


Access : atime

Modify : mtime

Change : ctime


[root@vps ~]# stat test.bin

  File: `test.bin'

  Size: 81388           Blocks: 160        IO Block: 4096   regular file

Device: 803h/2051d      Inode: 57618946    Links: 1

Access: (0644/-rw-r--r--)  Uid: (  0/    root)   Gid: (  0/    root)

Access: 2014-03-23 16:00:00.000000000 +0900

Modify: 2014-03-23 16:00:00.000000000 +0900

Change: 2017-01-31 15:04:22.764896137 +0900



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

리눅스 cp 디렉토리까지 복사 명령어



cp 로 디렉토리까지 복사하는 옵션입니다.


# cp --parents /tmp1/tmp2/* /tmp3/


--parents 옵션이 없으면 /tmp3 에 파일이 복사가 됩니다.


tmp2 디렉토리까지 mkdir 이 자동으로 생성되게 하려면 --parents 옵션을 사용하면 됩니다.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

리눅스 find 파일 찾기 명령어



파일 찾기 옵션과 삭제하기 그리고 tar 로 찾은 파일을 압축하는 방법도 알아봅시다.


atime : access time

mtime : modify time

ctime : change time


amin : access minute

mmin : modify minute

cmin : change minute


변경된지 5분전 이후 파일 찾기 ( 5분전 ~ )


# find ./ -cmin -5



수정된지 1주일이 지난 파일 찾기 ( ~ 7일전 )


# find ./ -mtime +7



수정된지 1주일 전 이후 파일 찾기 ( 7일전 ~ )


# find ./ -mtime -7



수정된지 2주일 전에서 1주일 전 파일 찾기 ( 14일전 ~ 7일전 )


# find ./ -mtime +7 -mtime -14



수정된지 1년이 지난 파일 리스트 만들기


# find ./ -mtime +365 -exec ls -al {} \; > list.txt



수정된지 1년이 지난 jpg 파일 삭제하기


# find ./ -name "*.jpg" -mtime +365 -exec rm -rf {} \;


주의해야 할 점이 있는데 find ./ -mtime +365 -exec rm -rf {} \; 로 파일을 지우게 되면 폴더가 범위에 포함되면 그 안의 파일까지 지워지게 됩니다.


이런 경우에는 위험하니까 -name 옵션을 사용하거나 -type f 이렇게 조건을 걸어주는게 좋습니다.



find 로 찾아서 압축하기


 find / -mtime +365 | xargs tar zcvfp test.tar.gz


압축이 잘 되었는지 확인해보세요~


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

리눅스 sftp 속도 제한

LINUX 2017. 1. 24. 11:05

리눅스 sftp 속도 제한



sftp 도 속도 제어가 가능합니다.


도움말을 한번 볼까요~


옵션에 보면 -l limit 라고 있습니다.


[root@conoha-jp ~]# sftp -h

usage: sftp [-1246aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]

          [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]

          [-o ssh_option] [-P port] [-R num_requests] [-S program]

          [-s subsystem | sftp_server] host

       sftp [user@]host[:file ...]

       sftp [user@]host[:dir[/]]

       sftp -b batchfile [user@]host



단위는 Kb/s 입니다.



실제로 테스트를 해보겠습니다.


500KB/s 로 한번 다운로드 받아볼까요~ 그러기 위해선 단위를 맞추어 주어야 합니다.


500KB/s = 4000Kb/s 가 됩니다.


[root@conoha-jp2 ~]# sftp -l4000 conoha.ivps.kr

Connected to conoha.ivps.kr.

sftp> get 100M.bin

Fetching /root/100M.bin to 100M.bin

/root/100M.bin                                100%  100MB 514.6KB/s   03:19


처음에는 속도가 빠르다가 점차 평균속도가 500KB/s 에 근접하게 됩니다.


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

리눅스 vi 편집기 문자열 일괄치환



리눅스 vi 에서 파일 전체에서 문자열을 일괄로 치환하는 방법입니다.


:%s/찾는문자열/바꿀문자열/g



100라인에서 200라인 사이의 문자열 치환


:100,200s/찾는문자열/바꿀문자열/g



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

리눅스 mod_deflate 특정 디렉토리만 압축기능 사용



특정 폴더만 압축기능을 사용할 수도 있습니다.


Directory 나 Location 지시어로 설정하면 됩니다.


<IfModule mod_deflate.c>

DeflateCompressionLevel 1

<Directory /var/www/html/test1>

SetOutputFilter DEFLATE

AddOutputFilterByType DEFLATE text/html

</Directory>

<Location /test2>

SetOutputFilter DEFLATE

AddOutputFilterByType DEFLATE text/html

</Location>

</IfModule>


DeflateCompressionLevel 옵션은 상위에만 줄 수 있는게 아쉽기는 하지만 위 처럼 디렉토리나 로케이션에 컨텐츠타입으로 옵션을 주면 됩니다.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,