







sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-<<>>.efs.ap-southeast-2.amazonaws.com:/ efs
ssh -i yslee-02.pem ec2-user@10.17.10.43

mount.nfs4: mount point efs does not exist
[ec2-user@ip-10-17-10-43 ~]$


/usr/share/nginx/html/ 뒷부분을 수정한다.sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-0ab42c49357c2b609.efs.ap-southeast-2.amazonaws.com:/ /usr/share/nginx/html/

ping fs-0ab42c49357c2b609.efs.ap-southeast-2.amazonaws.com

df -h

ls -l /usr/share/nginx/html
echo $HOSTNAME

hostname | sudo tee /usr/share/nginx/html/index.html
cat /usr/share/nginx/html/index.html
curl localhost

# NGINX-2A-01
ssh -i yslee-02.pem ec2-user@10.17.10.208
# NGINX-2A-00
ssh -i yslee-02.pem ec2-user@10.17.10.43
# NGINX-2A-00 에서 재시작도 한번 해본다.
sudo systemctl restart nginx.service

(2) EFS로 mount
NGINX-2A-01(10.17.10.208)으로 들어가본다
# NGINX-2A-01
ssh -i yslee-02.pem ec2-user@10.17.10.208
/usr/share/nginx/html로 수정한다.# efs 패키지
sudo dnf install -y amazon-efs-utils
# EFS 설정할 때 나온 주소로 변경
sudo mount -t efs -o tls fs-0ab42c49357c2b609:/ /usr/share/nginx/html


파일을 조금 탐색해봤다.
vi /etc/nginx/nginx.conf 부분 수정
Default로 되어 있는거 주석처리 해준다. 37번줄부터 주석
sudo vi /etc/nginx/nginx.conf

sudo nginx -t

# 마운트가 이쪽으로 되어야 한다.
sudo mount -t efs -o tls fs-0ab42c49357c2b609:/ /etc/nginx/conf.d/
# 마운트 한 후 default.conf에 들어있는 값
sudo vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name _;
location / {
return 200 "Hello! This is server: $hostname\n";
add_header Content-Type text/plain;
}
}

sudo systemctl restart nginx.service

sudo umount /usr/share/nginx/html

# NGINX-2A-00에서 설정
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-0ab42c49357c2b609.efs.ap-southeast-2.amazonaws.com:/ /etc/nginx/conf.d/


sudo mount -t efs -o tls fs-0ab42c49357c2b609:/ /etc/nginx/default.d/
# 파일을 새롭게 만들었다.
sudo vi /etc/nginx/default.d/location.conf
# 작성 내용
location / {
return 200 "$hostname";
add_header Content-Type text/plain;
}

umount /etc/nginx/conf.d/

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-0ab42c49357c2b609.efs.ap-southeast-2.amazonaws.com:/ /etc/nginx/default.d



sudo vi /etc/nginx/default.d/location.conf

