2017-03-06 1 views
0

그래서 나는 현재 웹 사이트에서 URL을 밝힐 수 없습니다. 그래서 나는이 질문에 대해 www.example.com이라고 부를 것이다.Nginx 리디렉션 없음 없음 www

내 사이트로 이동하여 HTTPS :: //www.example.com으로 리디렉션하려고합니다. 그러나 이것은 그렇지 않습니다. http를 https로 리디렉션하면서 작동하도록했습니다.

example.com으로 이동하면 www.example.com으로 리디렉션되지만 example.com/videos와 같은 다른 경로를 시도하면 https://www.example.com 대신 https://example.com/videos으로 리디렉션됩니다. 누군가가 도와 수 있다면

server{ 

    listen 80; 
    server_name example.com www.example.com; 
    rewrite ^/(.*) https://www.example.com/$1 permanent; 
} 

server { 
    listen 443 ssl; 

    server_name example.com www.thevirtualpornwebsite.com; 
    root /var/www/example_folder/public; 


    index index.php index.html index.htm index.nginx-debian.html; 


    ssl_certificate /home/example_user/example.com.chained.crt; 
    ssl_certificate_key /home/example_user/example.com.key; 

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; 


    location/{ 
     rewrite ^/(.*)/$ /$1 permanent; 
     try_files $uri $uri/ /index.php?$query_string; 
    } 

    location ~ \.php$ { 
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
    } 
} 

것은 그 좋은 것 :

여기 내의 nginx 설정 파일입니다!

답변

0

당신이 당신의 HTTP 서버 구성을 선택하면 당신이 기본적으로 주어진 URL과 일치하고이 경기는 나중에 매개 변수 $1 (정규 표현식을 확인)으로 새 위치로 전달되는 재 작성 규칙을

rewrite ^/(.*) https://www.example.com/$1 permanent; 

을 볼 수 있습니다. 이 매개 변수를 제거하면

, 당신은 당신이 원하는 무엇을 달성해야합니다

rewrite ^/.* https://www.example.com/ permanent;