본문 바로가기

프로그래밍

nginx에서 http https 로 리다이렉트 하기

 

server {
	listen 80;
	server_name domain.com www.domain.com;
	
    	return 301 https://domain.com$request_uri;
}

/etc/nginx/nginx.conf 에서 위와 같이 http 처리부분에서 301, https uri로 보내버린다.

 

 

나머지 처리들은 https 서버 블럭에서 처리해주면 된다.