0
您好,請在下面查看我的nginx配置。當我嘗試去我的主頁http://mydomain.com時出現以下錯誤。當我使用Chrome開發人員工具查看重定向時,我看到http://mydomain.com正在重定向到https://mydomain.com,並且來回移動。我查看了我的源代碼,但在那裏找不到任何重定向。我正在使用ssl_requirement插件。錯誤310.使用nginx + rails重定向過多3
任何幫助,非常感謝。
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;
}
}