아마존 라이트세일 nginx사용중이고
인증서 설치하고 도메인 접속 가능함
http랑 https 도메인 각각 접속해보면 인증서 잘 작동중이라
http접속을 https로 넘겨줄라는데
아마존 설명서 대로 bitnami.conf에 return 301 https://$host$request_uri; 추가하고
nginx 재부팅 해봤는데 안됨;;
뭐가 문제일까
아래는 conf 내용임
# HTTP server
server {
listen 80;
server_name localhost;
include "/opt/bitnami/nginx/conf/bitnami/phpfastcgi.conf";
return 301 https://$host$request_uri;
include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf";
}
# HTTPS server
server {
listen 443 ssl;
server_name localhost;
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html/build;
index index.html index.htm;
try_files $uri /index.html;
proxy_cookie_path / "/; secure; SameSite=None";
}
include "/opt/bitnami/nginx/conf/bitnami/phpfastcgi.conf";
include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf";
}
include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-vhosts.conf";
nginx 설정은 구글에 검색하면 잘 나와있음. 님이 못한거임
http 301인가 사용해서 redirect 하는거 일텐데 아마
그게 return 301
https://$host$request_uri;
아님?
nginx 로는 설정안해봐서 몰라 난 apache2 씀. 근데 웹서버에서 http 를 https 로 옮기는건 301 이나 302 redirect 쓰는거 맞아
아마존 자습서엔 bitnami.conf만 변경하는거로 나와있는데 혹시나 해서 nginx.conf도 변경해봤거든 근데 안되네...
기억날 듯 말 듯 하네 이거 $scheme = "http" redirect ~~~ 구문 적용했더니 됐음 한번 찾아봐
오 한번 찾아보겠음