我正在嘗試將舊的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