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

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

· 4년 전 · 2386 · 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
살펴 보도록 하겠습니다.
알려 주셔서 감사합니다.
필요했었는데.. 정보 감사합니다.

게시글 목록

번호 제목
16893
16890
16889
16888
16887
16886
16885
16884
16883
16882
16881
16880
16871
16870
16868
16863
16861
16856
16852
16834
16833
16829
16827
16826
16823
16822
16819
16818
16817
16806