반응형

nginx 4

[Nginx] The plain HTTP request was sent to HTTPS port

$> sudo vi /etc/nginx/conf.d/www.test.com.conf ... # ssl on -> 'ssl off' or comment out ssl off ... $> sudo systemctl restart nginx Nginx를 설정하다 보면 위와 같은 에러 문구를 만나기도 합니다. 이는 http로 접근된 프로토콜을 https로 전달하는 경우 발생합니다. 만약, http://www.test.com 로 접속하는 경우 https://www.test.com 으로 Redirect 하는 경우 발생할 수 있는 오류입니다. 이는 nginx의 ssl 설정이 on으로 된 경우 발생하며 $> sudo vi /etc/nginx/conf.d/default.conf 또는 $> sudo vi /etc/ngin..

개발 창고/Web 2023.02.28

[Nginx] 413 Request Entity Too Large

$> sudo vi /etc/nignx/nginx.conf ... http { ... # default client_max_body_size is 1MB; client_max_body_size 20M; ... } ... $> sudo service reload nginx 개발자 도구를 통하여 확인한 경우 413 Request Entity Too Large가 발생하였습니다. 이는 Nginx에 설정된 기본 client_max_body_size가 1MB인데, 이를 초과하는 body size가 들어왔기 때문입니다. 이는 파일 업로드시에 주로 발생하므로, nginx 설정 시에 꼭 client_max_body_size를 예측되는 최대 사이즈로 변경해주거나 0으로 제한을 해제해 주어야 합니다.

개발 창고/Web 2023.02.28

[React] Nginx 새로고침 404 에러 수정

location / { try_files $uri $uri/ /index.html =404; } React를 배포하고, Nginx를 활용하여 서비스를 실행한 경우, index.html을 통하여 원하는 페이지로 이동 시에는 잘 넘어 가지만, 이동한 페이지에서 새로고침(F5)을 하는 경우 404 에러를 발생하게 됩니다. 이를 해결하기 위해서는, 새로고침으로 전달된 uri 정보를 index.html를 통하여 uri로 이동하도록 설정을 해주어야 합니다. server { listen 80; server_name localhost; #access_log logs/localhost.log combined; location / { try_files $uri $uri/ /index.html = 404; root /dat..

반응형