검색결과 리스트
라이트세일에 해당되는 글 8건
- 2020.11.25 lightsail wordpress [pool wordpress] server reached pm.max_children setting (25) warninng
- 2020.08.07 lightsail로 워드프레스 사이트 시작하기- 6) 디스크 증설하기
- 2020.05.24 lightsail로 워드프레스 사이트 시작하기- 5) putty 환경 설정하기
- 2020.05.19 lightsail로 워드프레스 시작하기 - 3 ) updraftplus를 사용해서 워드프레스 이전하기
- 2020.05.19 lightsail로 워드프레스 사이트 시작하기- 4) 워드프레스 lightsail에 ssl 무료 적용하기 (https 인증서)
- 2020.05.19 lightsail로 워드프레스 사이트 시작하기 - 1) 인스턴스 생성하기
- 2020.03.17 lightsail로 워드프레스 사이트 시작하기 - 2) 워드프레스 로그인 정보 확인하기
- 2019.11.05 워드프레스 라이트세일 wp-signup redirect 이슈 (https://53.**.**.**.xip.io/wp-signup.php?new=mydomain.com)
글
lightsail wordpress [pool wordpress] server reached pm.max_children setting (25) warninng
트래픽은 큰 차이가 안나는데 갑자기 cpu 사용량이 치솟으면서 사이트가 먹통이 되는 현상이 발생하였다.
그 당시는 외부에서 발표중이여서 서버 재부팅으로 그 순간을 넘겼는데 그 후 같은 현상이 반복되서 원인 파악에 들어갔다.
php-fpm 에러로그 파일 위치
/opt/bitnami/php/var/log/php-fpm.log
php-fpm 세팅 파일 위치
/opt/bitnami/php/etc/php-fpm.conf
bitnami@ip:/opt/bitnami/php/etc$ sudo cat /opt/bitnami/php/var/log/php-fpm.log
[15-May-2020 12:52:48] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 3 idle, and 13 total children
[15-May-2020 12:52:56] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 14 total children
[15-May-2020 12:53:00] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 18 total children
[15-May-2020 12:53:03] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 22 total children
[15-May-2020 12:53:07] WARNING: [pool wordpress] server reached pm.max_children setting (25), consider raising it
[15-May-2020 12:56:03] WARNING: [pool wordpress] server reached pm.max_children setting (25), consider raising it
[16-May-2020 06:16:58] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 3 idle, and 13 total children
[16-May-2020 06:17:07] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 3 idle, and 14 total children
[16-May-2020 06:17:08] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 3 idle, and 15 total children
[16-May-2020 07:52:26] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 2 idle, and 21 total children
[16-May-2020 07:52:29] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 2 idle, and 23 total children
[16-May-2020 07:52:34] WARNING: [pool wordpress] server reached pm.max_children setting (25), consider raising it
워드프레스 pool쪽에서 문제가 생긴듯하다.
참고로 php-fpm에서 사용하는 설정 파일(conf) 찾는법
bitnam$ ps aux | grep php-fpm
root 3476 0.0 0.2 146396 9340 ? Ss 08:20 0:01 php-fpm: master process (/opt/bitnami/php/etc/php-fpm.conf)
daemon 3477 0.6 0.6 153868 25196 ? S 08:20 4:15 php-fpm: pool wordpress
daemon 3478 0.6 0.6 154064 25380 ? S 08:20 4:09 php-fpm: pool wordpress
해당 설정파일을 가면 마지막에 두 개의 pool 설정 파일을 include 하고 있다.
bitnam$ tail /opt/bitnami/php/etc/php-fpm.conf
include=/opt/bitnami/apps/wordpress/conf/php-fpm/pool.conf
include=/opt/bitnami/apps/phpmyadmin/conf/php-fpm/pool.conf
워드프레스 쪽의 설정 파일을 확인해본다.
bitnami@ip$ cat /opt/bitnami/apps/wordpress/conf/php-fpm/pool.conf
[wordpress]
listen=/opt/bitnami/php/var/run/wordpress.sock
include=/opt/bitnami/php/etc/common-dynamic.conf
include=/opt/bitnami/apps/wordpress/conf/php-fpm/php-settings.conf
include=/opt/bitnami/php/etc/environment.conf
pm=dynamic
여기서 다시 common-dynamic.conf를 include하고 있다.
다시 그 파일 설정으로 들어가면 common.conf 파일을 include하고 있다.
common.conf 파일까지 가야지 드디어
bitnami$ cat /opt/bitnami/php/etc/common-dynamic.conf
include=/opt/bitnami/php/etc/common.conf
pm=dynamic
pm.max_children=5
pm.start_servers=2
pm.min_spare_servers=1
pm.max_spare_servers=3
include=/opt/bitnami/php/etc/bitnami/common.conf
bitnami$ cat /opt/bitnami/php/etc/bitnami/common.conf
;
; Bitnami PHP-FPM Configuration
; Copyright 2019 Bitnami.com All Rights Reserved
;
; Note: This file will be modified on server size changes
;
pm.max_children=25
pm.start_servers=4
pm.min_spare_servers=4
pm.max_spare_servers=10
pm.max_requests=5000
각각의 옵션 설명은 아래 설정 파일의 설명을 참고하면 된다.
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm.max_children 수를 50으로 증가시키고 php-fpm을 재시작해서 변경 사항을 반영한다.
sudo /opt/bitnami/ctlscript.sh restart php-fpm
그런데 이 포스팅을 작성하면서 cpu 사용량이 조금씩 상승하고 있어서 아파치 접속 로그를 확인해봤더니
아래와 같이 존재하지 않는 경로를 요청하는 수상한 ip들이 보여서 검색해보니 최근에 스팸 등으로 블랙리스트에 신고된 아이피였다.
https://cleantalk.org/blacklists/173.212.194.14
bitnami$ tail -f /opt/bitnami/apache2/logs/access_log
173.212.194.14 - - [17/May/2020:00:22:28 +0900] "GET /product-tag/med/?product_orderby=popularity&product_count=24&product_view=grid&product_order=asc HTTP/1.1" 301 -
173.212.194.14 - - [17/May/2020:00:22:47 +0900] "GET /?product_orderby=popularity&product_count=24&product_view=grid&product_order=asc HTTP/1.1" 200 22179
이것만은 원인은 아니겠지만 그래도 원인 중 하나일 것 같아서 워드프레스 보안 플러그인 설정 변경도 해야겠다.
php-fpm status 쉽게 확인하는 법
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /bitnami/lamp73stack-linux-x64/output/php/share/php/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
그리고 응답이 늦어지는 상황을 좀 더 모니터링 하기 위해 slowlog를 설정한다
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
;slowlog = log/$pool.log.slow
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0
최종 변경사항들은 아래와 같다.
pm.status_path = /status
slowlog = log/$pool.log.slow
request_slowlog_timeout = 0
참고: https://www.tecmint.com/enable-monitor-php-fpm-status-in-nginx/
https://stackoverflow.com/questions/15465333/php-fpm-processes-monitoring-profiling
https://docs.bitnami.com/aws/apps/wordpress-pro/configuration/configure-phpfpm-processes/
설정
트랙백
댓글
글
lightsail로 워드프레스 사이트 시작하기- 6) 디스크 증설하기
라이트세일로 워드프레스 사이트 시작하기
6) 디스크 증설하기
서비스를 운영하다보니 이미지 업로드가 많아지면서 어느샌가 디스크가 부족해졌다.
얼추 보았을때는 aws lightsail console에서 아래에 있는 버튼 하나로
디스크를 추가할 수 있는 걸로 보인다.
실제로 디스크를 추가하면 instance에 부착까지는
아래 과정을 통해 한번에 된다.
그런데 df -h를 하면 새로 추가한 디스크가 나오지 않는다
아래 링크를 확인하면 디스크 포맷부터 mount를 스스로 해야 한다고 친절하게 알려준다(...)
나 이거 봤어. 서버 세팅 혼자 하던 시절...
예전에 물리 서버 혼자 운영할때도 다 했는데
aws도 마찬가지구나(...)
작업내용
새로 mount할 디스크를 기존 디스크와 같은 형태의 파일시스템으로 포맷합니다.
이떄 꼭 새로 붙이는 디스크가 비어있는지 확인해야합니다.
디스크 내용이 들어있으면 포맷하지 마세요!
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 11M 385M 3% /run
/dev/xvda1 78G 43G 35G 56% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 29M 29M 0 100% /snap/amazon-ssm-agent/2012
/dev/loop2 18M 18M 0 100% /snap/amazon-ssm-agent/1566
/dev/loop1 97M 97M 0 100% /snap/core/9436
/dev/loop3 97M 97M 0 100% /snap/core/9665
tmpfs 396M 0 396M 0% /run/user/1000
lsblk로 mount 정보 확인
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 80G 0 disk
└─xvda1 202:1 0 80G 0 part /
xvdf 202:80 0 256G 0 disk
loop0 7:0 0 28.1M 1 loop /snap/amazon-ssm-agent/2012
loop1 7:1 0 96.5M 1 loop /snap/core/9436
loop2 7:2 0 18M 1 loop /snap/amazon-ssm-agent/1566
loop3 7:3 0 97M 1 loop /snap/core/9665
새로 mount할 디스크 파일 타입 확인
$ sudo file -s /dev/xvdf
/dev/xvdf: data
기존에 mount되어있는 디스크 파일 타입 확인합니다. ext4를 사용하고 있네요.
$ sudo file -s /dev/xvda1
/dev/xvda1: Linux rev 1.0 ext4 filesystem data, UUID=9bd74952-5d49-4ac3-8b92-6491cf32a505, volume name "cloudimg-rootfs" (needs journal recovery) (extents) (large files) (huge files)
새로운 디스크도 ext4타입으로 포맷합니다. 이떄 꼭 새로 붙이는 디스크가 비어있는지 확인해야합니다.
디스크 내용이 들어있으면 포맷하지 마세요!
$ sudo mkfs -t ext4 /dev/xvdf
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 67108864 4k blocks and 16777216 inodes
Filesystem UUID: 1fba4148-faac-4675-a772-87a67e1b9d6d
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
새로 포맷한 디스크의 파일 타입을 확인하고 마운트를 실행한다.
새로 포맷한 디스크의 파일 타입 확인.
$ sudo file -s /dev/xvdf
/dev/xvdf: Linux rev 1.0 ext4 filesystem data, UUID=1fba4148-faac-4675-a772-87a67e1b9d6d (extents) (large files) (huge files)
마운트할 위치에 디렉토리를 생성하고
$ sudo mkdir /data
sudo mount device_name mount_point 로 mount를 실행한다.
$ sudo mount /dev/xvdf /data
df -h로 잘 마운트 되었는지 확인한다.
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 11M 385M 3% /run
/dev/xvda1 78G 48G 30G 62% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 29M 29M 0 100% /snap/amazon-ssm-agent/2012
/dev/loop2 18M 18M 0 100% /snap/amazon-ssm-agent/1566
/dev/loop1 97M 97M 0 100% /snap/core/9436
/dev/loop3 97M 97M 0 100% /snap/core/9665
tmpfs 396M 0 396M 0% /run/user/1000
/dev/xvdf 252G 60M 239G 1% /data
새로운 디스크 포맷할때 왠지 걱정되서 기존 서버 백업도 해두고 그랬는데
그냥 별문제없이 금방 끝났네요.
이렇게 디스크 증설이 별 문제없이 마무리되었습니다.
설정
트랙백
댓글
글
lightsail로 워드프레스 사이트 시작하기- 5) putty 환경 설정하기
lightsail로 워드프레스 사이트 시작하기
5) putty 환경 설정하기
putty로 라이트세일을 접근할 수 있도록 설정을 합니다.
워드프레스 서비스 이전을 하는거라 예전 워드프레스 putty 설정이 있어서 복사해서 ip만 변경했더니
아래와 같은 에러가 발생합니다.
Disconnected: No supported authentication methods available (server sent: publickey)
라이트세일 워드프레스 플랜 변경을 할때 예전 서버와 같은 프라이빗키를 사용하면 안되는 것인가요 -_-?
약간의 의문은 들지만 새로운 워드프레스에서 사용할 프라이빗 키를 생성해보도록 합니다.
생성방법은 다음 가이드 문서를 참조합니다.
1. pem 파일 다운로드
AWS 콘솔에서 라이트세일에서 계정정보(ACCOUNT)를 누르면
SSH keys에서 ssh key에 대해서 설정할 수 있습니다.
각 지역별로 라이트세일에서 기본적으로 제공하는 key를 사용할 수 있고
Create new + 를 클릭해서 새로 생성할 수도 있습니다.
새로 생성할 경우 다운로드는 한번만 가능하므로 안전한 위치에 보관해두세요.
그리고 다운로드 받은 pem에서 ssh에서 사용할 수 있는 ppk 형태로 변경해야 하는데
방법은 아래 가이드 문서를 참조합니다.
2. puttygen을 이용하여 ppk 파일 생성
PuTTYgen을 시작합니다(예: 시작 메뉴에서 모든 프로그램, PuTTY, PuTTYgen 선택).
로드(Load)를 선택합니다.
기본적으로 PuTTYgen에는 확장명이 .ppk인 파일만 표시됩니다. .pem 파일을 찾으려면 모든 유형의 파일을 표시하는 옵션을 선택합니다.
lightsailDefaultKey.pem을 선택한 다음 열기를 누릅니다.
PuTTYgen에서 키를 성공적으로 가져왔다고 확인해주면 확인을 선택할 수 있습니다.
Save private key(프라이빗 키 저장)를 선택한 다음 암호와 함께 저장하지 않을 것임을 확인합니다.
추가적인 보안 방법으로서 암호를 만들 경우에는 PuTTY를 사용하여 인스턴스에 연결할 때마다 암호를 입력해야 합니다.
프라이빗 키를 저장하기 위해 이름과 위치를 지정한 후 저장을 선택합니다.
PuTTYgen을 닫습니다.
3. putty에 ppk 파일 설정하기
이렇게 생성된 ppk파일을 putty-> connection -> ssh -> Auth 에서
private key file for authentication 에서 ppk 파일 위치를 설정해줍니다.
이제 에러 없이 문제없이 putty로 라이트세일 인스턴스로 접근이 가능합니다.
설정
트랙백
댓글
글
lightsail로 워드프레스 시작하기 - 3 ) updraftplus를 사용해서 워드프레스 이전하기
lightsail로 워드프레스 시작하기
3 ) updraftplus를 사용해서 워드프레스 이전하기
라이트세일을 사용해서 워드프레스를 사용하고 있는데 포스팅 양이 많아지면서
공간이 부족해서 상위 플랜으로 이동하기로 했다.
라이트세일은 상위 플랜으로 이동시 새 인스턴스를 띄어서 가야해서
일단 새 인스턴스를 띄우고 기존 백업 플러그인 updraftplus에서 백업한 파일을 사용해서 복원을 하려고 했다.
updraftplus에서 existing backup을 선택하고
기존 백업해둔 파일들을 올린다.
그리고 restore 버튼을 클릭하면 아래와 같이 복원이 진행이 된다.
전체 복원을 선택한다.
그런데 중간에 백업파일은 다른 사이트에서 와서 이것은 복원이 아니라 이전이라며
migrator add on이 필요하다고 한다.
링크를 따라가보니 한번 이전에 30불(60일 지원)이다.
예전같으면 그냥 시간 걸려도 스스로 했겠지만
요즘 만사가 귀찮다. 30불을 질러본다.
그 후 아무 안내도 안떠서 당황했는데 이메일을 확인해보니 위와 같이 migrator add on이 들어간 플러그인이 도착을 했다.
기존에 updraftplus plugin이 설치되어 있으면 삭제하고 다시 위 파일로 플러그인을 설치한다.
설치방법은 plugins -> Add new -> 파일 넣기 -> 네트워크 활성화 이다.
그러면 migrate/clone 탭에서 무료 버전에서는 보이지 않는 세개의 파란 버튼이 뜬다.
이중 기존 백업에서 이전을 하는 것이니 첫번째 버튼을 클릭!
기존 백업 리스트가 나오면 restore를 누른다.
이전과 동일하지만 이제는 바로 워드프레스 이전이 가능하다.
위와 같이 복원이 진행되다가 갑자기 세션이 끊겼다면서 다시 로그인을 하라고 한다.
이 때 기존 암호를 넣으면 로그인이 안된다.
당황하지 말고 이전 사이트의 로그인 정보를 넣으면 로그인이 된다.
로그인 암호까지도 기존과 같이 들어갔다.
그리고 로그인을 하면 이전과 똑같은 관리자 화면이 나온다.
10분이면 이전이 완료된다.
역시 돈이 최고구나 (...)라는 교훈을 남기고 워드프레스 이전 끝.
이제 다음은 ssl로 https 설정하는 과정이 진행된다.
설정
트랙백
댓글
글
lightsail로 워드프레스 사이트 시작하기- 4) 워드프레스 lightsail에 ssl 무료 적용하기 (https 인증서)
lightsail로 워드프레스 사이트 시작하기
4) aws 워드프레스 lightsail에 ssl 무료 적용하기
최근에 aws에서 lightsail을 사용하여 워드프레스를 생성하고 있습니다.
워드프레서 설치까지는 간단하게 완료가 되었고
이제 보안을 생각해서 http->https 로 변경하기 위해서는 ssl 인증서를 설치해야 합니다.
처음에는 aws에서 제공하는 ssl 을 사용하려고 했습니다. (아래 링크 참조)
https://docs.aws.amazon.com/ko_kr/acm/latest/userguide/gs-acm-validate-dns.html
https://docs.aws.amazon.com/ko_kr/acm/latest/userguide/troubleshooting-route53.html
https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-2.html
그런데 아무리 해도 ACM 콘솔에서 "Route 53 에 레코드 생성" 버튼이 나타나지 않는 것입니다 -_- ;
고민하다가 무료로 제공한다는 Let's Encrypt 인증서를 사용하기로 했습니다.
letsencrypt 설치하기
일단 letsencrypt 패키지를 설치합니다.
sudo apt-get install git
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
letsencrypt 인증서 생성하기
letsencrypt-auto certonly 명령어로 인증서를 생성합니다.
중간에 인증 방식이 나오는데 webroot 디렉토리에 파일을 저장하겠다고 선택합니다.
sudo /home/bitnami/letsencrypt/letsencrypt-auto certonly -w /home/bitnami/apps/wordpress/htdocs -d yourdomainname.com
How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 도메인이름.com
Using the webroot path /home/bitnami/apps/wordpress/htdocs for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/도메인이름.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/도메인이름com/privkey.pem
Your cert will expire on 2020-01-27. To obtain a new or tweaked
version of this certificate in the future, simply run
letsencrypt-auto again. To non-interactively renew *all* of your
certificates, run "letsencrypt-auto renew"
인증서의 위치는 /etc/letsencrypt/live/[domain]/ 위치에 있습니다
cert.pem : 인증서 파일
chain.pem : 인증서 발급자 파일
fullchain.pem : cert.pem+chain.pem
privkey.pem : 인증암호를 복호화하는 개인키
Apache 설정파일에 인증서 정보 알리기 및 재시작
sudo vi /home/bitnami/stack/apache2/conf/bitnami/bitnami.conf Bitnami Configuration 파일이 나타나면 다음 줄을 편집해야합니다. 위에서 확인한 인증서 파일들 위치를 아래와 같이 입력하고 저장합니다.
SSLCertificateFile “/etc/letsencrypt/live/yourdomain.com/cert.pem”
SSLCertificateKeyFile “/etc/letsencrypt/live/yourdomain.com/privkey.pem”
SSLCertificateChainFile “/etc/letsencrypt/live/yourdomain.com/chain.pem”
sudo /opt/bitnami/ctlscript.sh restart 로 아파치 재시작합니다.
인증서가 정상적으로 적용되었는지는 아래 사이트에서 확인할 수 있습니다.
https://www.ssllabs.com/ssltest/
인증서 자동갱신
let's encrypt 인증서는 90일마다 갱신해야 합니다.
자동으로 인증서를 갱신하려면 crontab -e를 해서 아래 명령어를 입력합니다.
크론탭에서 시간 표시 방법은 아래와 같습니다.
* * * * *
분(0-59) 시간(0-23) 일(1-31) 월(1-12) 요일(0-7)
매달 1일 오전 2시에 자동으로 갱신이 되도록 등록해두었습니다.
그리고 아래와 같이 수동으로 갱신을 할때
an unexpected error: [Errno 32] Broken pipe. Skipping. 에러가 발생한 적이 있어서 기록해둡니다.
원인은 간단합니다. sudo 를 입력하지 않았습니다;;
$ /home/bitnami/letsencrypt/letsencrypt-auto renew | sudo /opt/bitnami/ctlscript.sh restart
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
/opt/bitnami/php/scripts/ctl.sh : php-fpm stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
/opt/bitnami/php/scripts/ctl.sh : php-fpm started
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for www.도메인.co.kr
http-01 challenge for www.도메인.com
http-01 challenge for 도메인.co.kr
http-01 challenge for 도메인.com
Using the webroot path /home/bitnami/apps/wordpress/htdocs for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Attempting to renew cert (도메인.com) from /etc/letsencrypt/renewal/도메인.com.conf produced an unexpected error: [Errno 32] Broken pipe. Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/도메인.com/fullchain.pem (failure)
An unexpected error occurred:
IOError: [Errno 32] Broken pipe
Please see the logfiles in /var/log/letsencrypt for more details.
참조
https://mitny.github.io/articles/2019-01/LetsEncrypt
https://websiteforstudents.com/setup-apache2-with-http-2-and-lets-encrypt-ssl/
https://findstar.pe.kr/2018/09/08/lets-encrypt-certificates-rate-limit/
설정
트랙백
댓글
글
lightsail로 워드프레스 사이트 시작하기 - 1) 인스턴스 생성하기
라이트세일로 워드프레스 사이트 시작하기
1) instance 생성
라이트세일(lightsail)은 아마존에서 제공하는 가상 서버로
aws ec2에 비해 제공하는 기능도 한정적이긴한데
그냥 간단히 워드프레스 사이트 하나만들기에는 좋다.
라이트세일 장점
1. 확장성 : 가볍게 시작해서 사용자가 늘면 언제든지 확장이 가능하다.
2. 낮은 가격: 그리고 최고 사양으로 해도 월 160불로 ec2에 비해 확실히 저렴하다.
3. 편리함 : 워드프레스가 당장 설치되어 나오고 백업, 알림 등 클릭 한번으로 설정이 가능하다.
라이트세일 단점
1. 설정의 한계: 방화벽 같은 설정도 포트는 열 수 있는데 ip 대역별로 설정은 할 수 없다.
2. bitnami 만의 설정방식이 존재 : 이건 단점이라기 보다는 미리 깔아놓은 워드프레스를 사용하다 보니
기존에 사용하던 설정 방식을 사용못하고 적응해야 하는 시간이 필요하다.
처음에는 편한데 중간에 한번 문제 있으면 골치아픔.
3. 확장성이 있긴 하지만 ec2보다는 확장이 용이하지는 않음.
예를 들어 상위 플랜으로 가려면 스냅샾을 떠서 인스턴스를 따로 띄우고 세팅을 해야 하는데 꽤 번거로움.
그래도 싸고 편하니까 라이트세일로 새로운 워드프레스 사이트를 하나 더 추가해보기로 한다.
=> 2021년 추가 ) 워드프레스는 모르겠는데 앱이나 웹사이트를 운영하는 것이면 라이스세일 비추
일단 ip가 변경되어야 하고 사용자가 있는 서비스는 여러모로 번거로움.
메모리 증설하는 것도 상위버전으로 가야하고. 그냥 처음부터 ec2로 가는 것이 나을 것 같다.
여기서 오른쪽의 Create Instance 버튼을 클릭한다.
지역은 한국을 선택하고 리눅스를 선택하고 워드프레스를 선택하면
워드프레스 자동으로 설치되어 제공된다.
가격대를 선택한다. 가장 낮은 가격은 월 $3.5불로 메모리 512MB, 20기가 저장공간으로
일반적인 워드프레스 웹사이트면 이정도도 충분하다.
사용하다 필요하면 언제든지 용량을 늘리거나 상위 플랜으로 옮길수 있다.
다만 여기서 문제가 되었던 것이
이미 한국에 운영하고 있는 라이트세일 인스턴스가 두 개 있었다.
그런데 라이트세일 인스턴스를 2개 밖에 못만든다고 에러가 나온다.
하나는 운영중이지만 하나는 안쓰고 있는 것이라 중단해봤는데도 에러 메세지는 동일하다.
혹시해서 다른 지역(도쿄)를 선택하니 문제 없이 생성이 된다.
각 지역당 인스턴스 2개 제한인 것 같다.
유저당 13개 지역 * 2개 = 총 26개의 라이트세일 인스턴스를 생성할 수 있다.
왜 이런 제한을 두었는지는 의미를 잘 모르겠지만
그래도 생성이 되었으나 이제 사이트에 접속해본다.
인스턴스가 생성되면 아래와 같은 화면이 나온다.
인스턴스를 클릭해서 들어가면 아래와 같이 public ip를 확인할 수 있다.
아래와 같이 웹사이트에 public ip를 입력하면 아래와 같은 화면 나온다.
이제 워드프레스 설정을 할 수 있는데 길어져서 다음 포스팅에 이어서 설명하겠다.
설정
트랙백
댓글
글
lightsail로 워드프레스 사이트 시작하기 - 2) 워드프레스 로그인 정보 확인하기
라이트세일로 워드프레스 시작하기
2) 워드프레스 설정하기
이전글 : 1) 인스턴스 생성하기
이전 포스팅에서 인스턴스를 생성하고 나온 public ip로
사이트에 접속을 하면 아래와 같은 화면이 나온다.
오른쪽 아래에 있는 bitnami 배너(manage)를 클릭하면
아래와 같이 워드프레스 기본 설정에 대한 안내를 해준다.
일단 워드프레스 로그인 정보를 얻어야 하는데
라이트세일에서 사용자 id는 기본적으로 user로 나온다.
비밀번호는 아래와 같은 방식으로 확인 가능하다. (참고사이트)
라이트세일 콘솔에서 ssh를 사용하여 접속을 해서 아래와 같이 사용자 암호를 확인할 수 있다.
cat ./bitnami_credentials
Welcome to the Bitnami WordPress Stack
******************************************************************************
The default username and password is 'user' and '이부분비밀번호'.
******************************************************************************
You can also use this password to access the databases and any other component the stack includes.
Please refer to https://docs.bitnami.com/ for more details.
그리고 이어서 아래와 같이 사이트에 접속할 때 나오는 비트나미 배너를 없앤다. [참고방법]
/opt/bitnami/apps/wordpress$ sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
#아파치를 재시작한다.
/opt/bitnami/apps/wordpress$ sudo /opt/bitnami/ctlscript.sh restart apache
Unmonitored apache
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
Monitored apache
그리고 다시 사이트에 접속하면 아래와 같이 배너가 사라져있다.
이제 워드프레스에 로그인해서 테마를 설치해보자.
설정
트랙백
댓글
글
워드프레스 라이트세일 wp-signup redirect 이슈 (https://53.**.**.**.xip.io/wp-signup.php?new=mydomain.com)
워드프레스 라이트세일 wp-signup redirect 이슈
aws 라이트세일로 멀티사이트 워드프레스(multisite wordpress)를 설치했습니다.
도메인 provider에 고정 주소도 설정하고 https 까지 적용이 잘 되었는데
이상하게 자꾸 아래와 같은식으로 wp-signup.php 로 redirect로 되는 것입니다 ㅠㅠ
https://53.**.**.**8.xip.io/wp-signup.php?new=mydomain.com
일단 아래 설정 파일들을 다 확인해보고 온갖 삽질을 하다 간단하게 해결이 되었습니다 ㅠㅠ
vi /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf
vi /opt/bitnami/apps/wordpress/htdocs/wp-config.php
참고 :
https://seoulrain.net/2018/05/13/lightsailprimarydomainerror/
https://docs.bitnami.com/aws/faq/configuration/configure-custom-domain/
https://docs.bitnami.com/virtual-machine/faq/configuration/use-bnconfig/