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

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

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

게시글 목록

번호 제목
16329
16328
16327
16326
16325
16324
16323
16322
16321
16320
16319
16318
16317
16316
16315
16310
16309
16308
16305
16304
16303
16302
16301
16300
16299
16298
16297
16295
16294
16293