Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Redirect 如何在ssl中重定向两个域?_Redirect_Ssl_Nginx - Fatal编程技术网

Redirect 如何在ssl中重定向两个域?

Redirect 如何在ssl中重定向两个域?,redirect,ssl,nginx,Redirect,Ssl,Nginx,我有一个域名englishname.ca,我想重定向到englishname.com。我做了一些配置,它可以使用HTTP,但不能使用https。但我转到,我被重定向到,但当我转到,我没有重定向 这是我的配置文件: server { server_name 162

我有一个域名englishname.ca,我想重定向到englishname.com。我做了一些配置,它可以使用HTTP,但不能使用https。但我转到,我被重定向到,但当我转到,我没有重定向

这是我的配置文件:

server {                                                                                                               
        server_name 162.243.216.109 staging.frenchname.com staging.englishname.ca staging.singularenglishname.com;
        add_header X-Frame-Options "SAMEORIGIN";

        rewrite  ^/(.*)$  $scheme://staging.englishname.com/$1 permanent;                                  
} 

server {
        listen 80 default deferred;
        server_name www.englishname.com staging.englishname.com;                               
        root /home/deployer/apps/site/current/public;   

        location ^~ /assets/ {                                                                                         
                gzip_static on;
                expires max;
                add_header Cache-Control public;
        }

        try_files $uri/index.html $uri @unicorn;
        location @unicorn {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_pass http://unicorn;
        }

        error_page 500 502 503 504 /500.html;
        client_max_body_size 4G;
        keepalive_timeout 10;
}

server {
        listen 443 default ssl;
        server_name www.englishname.com staging.englishname.com;
        root /home/deployer/apps/site/current/public;

        ssl on;
        ssl_certificate /etc/ssl/certs/www.englishname.crt;
        ssl_certificate_key /etc/ssl/private/www.englishname.key;

        ssl_session_timeout 5m;
        ssl_protocols sslv3 tlsv1 tlsv1.1 tlsv1.2;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location ^~ /assets/ {
                gzip_static on;
                expires max;
                add_header Cache-Control public;
        }

        try_files $uri/index.html $uri @unicorn;
        location @unicorn {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_redirect off;
                proxy_pass http://unicorn;
        }

        error_page 500 502 503 504 /500.html;
        client_max_body_size 4G;
        keepalive_timeout 10;
}

我能做什么?

我找到了答案,我只是添加了以下几行:

server {
        listen 443;
        server_name 162.243.216.109 staging.lescollectionneursassocies.com staging.associatedartcollectors.ca staging.associatedartcollector.com;
        add_header X-Frame-Options "SAMEORIGIN";

        rewrite  ^/(.*)$  $scheme://staging.associatedartcollectors.com/$1 permanent;
}

与beggin相同,但使用listen 443。

我看不到上面有任何重定向。前6行是我的重定向。我想我最好将此留给比我更了解nginx的人。