您好,请在下面查看我的 nginx 配置。当我尝试访问我的主页http://mydomain.com时,出现以下错误。当我使用 Chrome 开发人员工具查看重定向时,我看到http://mydomain.com正在重定向到https://mydomain.com来回。我查看了我的源代码,但在那里找不到任何重定向。我正在使用 ssl_requirement 插件。
任何帮助是极大的赞赏。
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
下面是我的nginx配置文件
server {
listen 80;
server_name www.mydomain.com;
rewrite ^/(.*) http://mydomain.com/$1 permanent;
}
server {
listen 80;
server_name mydomain.com;
access_log /var/www/mydomain/current/log/access.log;
root /var/www/mydomain/current/public;
passenger_enabled on;
passenger_use_global_queue on;
location ~ /\.ht {
deny all;
}
}
server {
listen 443;
ssl on;
ssl_certificate /home/ubuntu/ssl-cert/nopassphrase.pem;
ssl_certificate_key /home/ubuntu/ssl-cert/nopassphrase.key;
server_name www.mydomain.com;
rewrite ^/(.*) http://mydomain.com/$1 permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /home/ubuntu/ssl-cert/nopassphrase.pem;
ssl_certificate_key /home/ubuntu/ssl-cert/nopassphrase.key;
server_name mydomain.com;
access_log /var/www/mydomain/current/log/access.log;
root /var/www/mydomain/current/public;
location ~* \.(ico|jpg|gif|png|css|js|swf|html)$ {
if (-f $request_filename) {
expires max;
break;
}
}
passenger_enabled on;
passenger_use_global_queue on;
location ~ /\.ht {
deny all;
}
}