devops 썸네일형 리스트형 Nginx 로그 날짜 별로 관리하기 문제점/var/log/nginx의 로그를 보면 access.log 1 , access.log 2와 같이 날짜 별로 로그가 나오지 않아 특정 날짜에 일어난 로그를 찾아보기 힘들다.해결방안로그 파일의 앞에 날짜를 붙혀 특정 날짜의 log를 쉽게 찾는다.1. logrotate의 nginx 설정 파일 이동sudo vim /etc/logrotate.d/nginx2. 설정 파일 수정(1) 수정 전/var/log/nginx/*.log { daily missingok rotate 14 compress delaycompress notifempty create 0640 www-data adm sharedscripts .. 더보기 docker-compose를 이용한 MySQL서버를 배포하고 Spring연동하기 1. Spring (1) Gradle dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' } 테스트를 위해 springweb,spring.. 더보기 Nginx 보안 강화하기 1.도메인이 아닌 IP로 들어오는 요청 막기 server { listen 80 default_server; return 444; } server { listen 443 default_server ssl; ssl_certificate /etc/letsencrypt/live/[domain]/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/[domain]/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;.. 더보기 docker-compose를 이용한 spring,Nginx 서버 연결 및 https설정하기 1.docker-compose 다운 sudo apt install docker-compose 2.Nginx spring.conf(/nginx/conf.d/spring.conf) 작성 upstream app{ server docker_gradle:8081; } server { listen 80; server_name [domain]; #access_log /var/log/nginx/host.access.log main; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { proxy_pass http://app; } } upstream: server 설정에서 Nginx 받아들인 요청을 어떤 서버로 흘려보내 줄 것인지 결정.. 더보기 docker volume을 이용하여 Nginx 배포하기(가비아 도메인 연결) 1.가비아도메인 A 레코드 설정 1-1. DNS관리툴 접속 My 가비아 -> DNS 관리 툴에서 설정 할 도메인을 선택합니다. 1-2 DNS 설정 레코드 설정을 누른 후 타입에 A 호스트에 www,@을 입력하고 값/위치에 public ip를 입력하고 저장합니다. 2.Nginx 이미지 Pull docker pull nginx 위 명령어를 통해 nginx 이미지를 들고옵니다. 3.Nginx 볼륨 설정 1.nginx.conf #nginx.conf 파일 생성 vim nginx.conf user nginx; worker_processes auto; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { worker_connection.. 더보기 Jenkins Pipeline으로 Docker 서버에 배포하기(gradle,jar) 1.Pipeline 생성 jenkins에서 새로운 아이템을 Pipeline으로 생성해줍니다. 2.Gradle 버전 설정 jenkins 관리 ->Tools ->Gradle installations에 Gradle이 설정되있는지 확인합니다. 3. Pipeline Script 생성 pipeline { agent any stages { stage('github clone') { steps { git branch: 'master', credentialsId: 'jenkins_gradle', url: 'https://github.com/yougeun6021/Jenkins_gradle_jar' } post{ failure{ ehco 'fail github clone' } } } stage('Grant execute p.. 더보기 Ubuntu에 docker 설치하기 1.시스템 패키지 업데이트 sudo apt-get update 2.Docker의 공식 GBG 추가 sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc 3.Docker의 공식 apt 저장소를 추가 echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://do.. 더보기 Rashberry pi Ubuntu 서버 설치 및 외부 아이피 ssh 연결 1. SD 카드 Ubuntu 설치 1-1 Rashberry imager 설치 https://www.raspberrypi.com/software/ 위 사이트에 들어가 Rashberry imager를 설치해줍니다. 1-2 SD카드 Ubuntu 이미지 다운 라즈베리파이 디바이스를 고르고 운영체제는 Ubuntu 저장소는 SD카드의 저장소를 선택해주고 다운받아줍니다. 1-3 Ubuntu 확인 라즈베리파이에 SD카드를 꼽고 부팅하면 Ubuntu 설치가 완료됩니다. 2.Ubuntu 서버 초기 설정하기 2-1 root 계정 활성화 sudo passwd root root 계정은 비밀번호를 생성해주어야 활성화 되기 때문에 root계정을 활성화해줍니다. 2-2 패키지 업데이트 #설치되어 있는 패키지들이 새로운 버전이 있는지.. 더보기 이전 1 2 3 다음