我正在尝试将旧的ssl域重定向到新的ssl域。但它正在向我发送重定向循环。将旧域重定向到带有SSL的新域nginx
我已经在nginx虚拟主机中尝试过这种配置。
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com old-domain.com;
rewrite^https://www.example.com$request_uri permanent;
}
server {
#SSL Configuration
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
root /home/username/example/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com old-domain.com;
rewrite^https://www.example.com$request_uri permanent;
location/{
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
请指导如何解决此问题。
你有旧域单独的证书文件? –
证书对于这两个域都是相同的。 – Danish