개발 & IT/백엔드 (51) 썸네일형 리스트형 [apache2] SPA(Single Page Application) 새로고침 시 404 error vue 와 같은 spa는 server side application과 달리 이름 그대로 "단일" 페이지를 로드한다. 즉, index.html에 대해서만 인식하고 있다는 의미. 서버는 클라이언트의 js를 브라우저에 전달하기 위해서만 존재하고 있다.. 그래서 라우팅은 클라이언트 측에서 처리하고 콘텐츠만 업데이트 후 url을 변경한다. 문제는 이러한 환경에서 경로를 직접 입력하여 이동하거나 이동한 페이지에서 새로고침을 하면 해당 url을 인식하지 못해 404 에러가 발생한다. (클라이언트는 오직 index.html ("/")만 인식하고있기 때문에..) 이를 방지하기 위해 모든 경로에 index.html로 응답하도록 서버쪽에 설정해줄 수 있다. 아래와 같이. (apache2 설정임) RewriteEngine O.. [Laravel] log permission denied laravel server 운용중 아래와 같은 에러 발생 The stream or file "/var/www/html/{server-dir}/storage/logs/laravel-2023-07-11.log" could not be opened in append mode: failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file 로그 파일을 write 할 권한이 없다는 오류. 원인은 라라벨 스케쥴러를 crontab 으로 등록할 때 root user로 등록해서, root user가 생성한 log 파일을 서버 실행 유저 (nginx)가 접근하지 못하기 때문이었다. 해결방법: .. [php] version switch sudo update-alternatives --config php update-alternaives --config 입력시 위와 같은 버전 switch 입력 메시지가 확인되고, 원하는 버전을 입력하면 변경된다. [PHP] version update (ubuntu) php package 저장소 추가 sudo add-apt-repository ppa:ondrej/php sudo apt-get update 현재 버전보다 높은 버전의 php install sudo apt install php8.0-common php8.0-cli -y php 버전 및 모듈 확인 php -v php -m 필요에 따라 다른 확장패키지를 php8.0-{name} 으로 추가하면 된다. https://php.watch/articles/php-8.0-installation-update-guide-debian-ubuntu [JPA] native query 에서 @변수 사용 시 오류 jpa native query 에서 @로 변수를 선언해서 사용했을 떼 Space is not allowed after parameter prefix 위와 같은 오류 발생. @rownum\\:=@rownum+1 \\ 역슬래시 적용하면 문제가 해결된다. hibaernate 버전에 따라 역슬래시를 하나만 써도 된다고 함 [Spring Boot] JPA native query to dto throw error nativequery의 결과를 dto에 담으려고 하니 아래와 같은 에러 발생 No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type https://www.baeldung.com/jpa-queries-custom-result-with-aggregation-functions jpa 쿼리는 보통 맵핑된 엔티티 인스턴스를 결과로 생성하지만,, 네이티브 쿼리를 이용한 결과는 object를 반환한다. 그래서 아래와 같이 Object로 정의해서 엑세스가 가능하지만, key, value 형태의 리턴이 .. [Spring boot] JPA hibernate second level cache with redisson 이미 조회된 DB데이터의 접근 비용을 줄이기 위해 데이터를 캐시하여 retrieve 한다. https://redisson.org/glossary/hibernate-second-level-cache.html What is the Hibernate second-level cache? | Redisson Part of Hibernate’s efficiency comes from the use of a component called the “second-level cache” or “L2 cache.” So what is the Hibernate second-level cache, and how should you use it? redisson.org level2 cache는 큰사이즈의 데이터를 저장하지만 le.. [Spring Boot] Jwt gradle 설정 implementation 'io.jsonwebtoken:jjwt-api:0.11.5' implementation 'io.jsonwebtoken:jjwt-impl:0.11.5' implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5' JwtTokenProvider 생성 import java.security.Key; import java.util.Base64; import java.util.Date; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; import org.springframewo.. 이전 1 2 3 4 5 6 7 다음