테스트 사이트 - 개발 중인 베타 버전입니다

https 에서 www 있는 도메인을 없는 도메인으로 rewrite 또는 redirect 하기

· 4년 전 · 2387 · 4

Nginx 설정 입니다.

 

 

...

 

    server {
       listen         80;
       server_name    your-domain.com www.your-domain.com;

       rewrite ^/(.*) https://your-domain.com/$1 permanent;
    }

 

    server {
        listen        443 ssl;
        server_name   www.your-domain.com;

        ssl_certificate          conf.d/your-domain.com.crt.pem;
        ssl_certificate_key      conf.d/your-domain.com.key.pem;
        ssl_trusted_certificate  conf.d/your-domain.com.ca-chain-bundle.pem;

        rewrite ^/(.*) https://your-domain.com/$1 permanent;
    }

 

    server {
        listen        443 ssl;
        server_name   your-domain.com;
        root          /home/your-domain/www;

        ssl_certificate          conf.d/your-domain.com.crt.pem;
        ssl_certificate_key      conf.d/your-domain.com.key.pem;
        ssl_trusted_certificate  conf.d/your-domain.com.ca-chain-bundle.pem;

 

...

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 4개

4년 전
좋은 정보 감사합니다.
rewrite ^/(.*) https://your-domain.com/$1 permanent;
==>
return 301 http://your-domain.com$request_uri;

https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#taxing-rewrites
살펴 보도록 하겠습니다.
알려 주셔서 감사합니다.
필요했었는데.. 정보 감사합니다.

게시글 목록

번호 제목
17191
17162
17160
17158
17156
17155
17153
17151
17145
17135
17131
17125
17114
17107
17099
17096
17089
17088
17082
17079
17078
17077
17070
17068
17067
17063
17060
17048
17045
17044