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

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

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

게시글 목록

번호 제목
16286
16281
16277
16276
16268
16266
16264
16263
16262
16259
16258
16257
16255
16233
16229
16222
16220
16219
16217
16214
16213
16211
16207
16205
16197
16195
16192
16191
16188
16187