march1993 发表于 2018-5-1 22:07:12

akige 发表于 2018-5-1 21:56
报错:

Firefox has detected that the server is redirecting the request for this address in a wa ...





server {
        listen 80 ;
       
        listen 443 ssl http2;
        ssl on;
        ssl_certificate /usr/local/nginx/conf/ssl/www.mysite.com/fullchain.cer;
        ssl_certificate_key /usr/local/nginx/conf/ssl/www.mysite.com/www.mysite.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
       
        server_name www.mysite.com mysite.com;
       
        if ($http_host != $server_name) {
                return 301 https://$server_name$request_uri;
        }
        if ($scheme = http) {
                return 301 https://$server_name$request_uri;
        }


        index index.html index.htm index.php default.html default.htm default.php;
        root/home/wwwroot/www.mysite.com;
       
        include rewrite/laravel.conf;
               
        include enable-php-pathinfo.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
                expires      12h;
        }

        location ~ /.well-known {
                allow all;
        }

        location ~ /\.
        {
                deny all;
        }

        access_log/home/wwwlogs/www.mysite.com.log;
}

陈道临 发表于 2018-5-1 22:11:40

server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.baidu.com baidu.com;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
if ($host != www.baidu.com) {return 301 $scheme://www.baidu.com$request_uri;

这样写一个server块就够了 看着舒服yc010t

ponyxx 发表于 2018-5-1 22:12:36

为何不试试meta跳转?

akige 发表于 2018-5-1 22:17:43

本帖最后由 akige 于 2018-5-1 22:19 编辑

march1993 发表于 2018-5-1 22:07


大佬 按照你的测试还是不行:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

nginx -s reload 有做

akige 发表于 2018-5-1 22:21:11

ponyxx 发表于 2018-5-1 22:12
为何不试试meta跳转?

想在服务端做

akige 发表于 2018-5-1 22:31:17

陈道临 发表于 2018-5-1 22:11
server {
listen 80;
listen [::]:80;


还是有问题。。大佬你测试过吗?

akige 发表于 2018-5-1 22:32:47

陈道临 发表于 2018-5-1 22:11
server {
listen 80;
listen [::]:80;


能贴一个完整的。你测试过的吗?我看着你配的貌似是那个逻辑,但是测试确实不行。跟我之前写的情况有点类似。

march1993 发表于 2018-5-1 22:34:09

akige 发表于 2018-5-1 22:32
能贴一个完整的。你测试过的吗?我看着你配的貌似是那个逻辑,但是测试确实不行。跟我之前写的情况有点类 ...

发个url来看看吧

akige 发表于 2018-5-1 22:45:16

陈道临 发表于 2018-5-1 22:11
server {
listen 80;
listen [::]:80;



server
        {
                listen 80;
                listen [::]:80;
                listen 443 ssl http2;
                listen [::]:443 ssl http2;
                server_name www.mysite.com mysite.com;
               
                if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
                if ($host != www.mysite.com) {return 301 $scheme://www.mysite.com$request_uri;}
               
               
               
      ssl on;
      ssl_certificate /usr/local/nginx/conf/ssl/www.mysite.com/fullchain.cer;
      ssl_certificate_key /usr/local/nginx/conf/ssl/www.mysite.com/www.mysite.com.key;
      ssl_session_timeout 5m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
      ssl_session_cache builtin:1000 shared:SSL:10m;
      # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
      ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
      
      
      index index.html index.htm index.php default.html default.htm default.php;
               
      root/home/wwwroot/www.mysite.com;
      
      include rewrite/laravel.conf;
               
      include enable-php-pathinfo.conf;

               
      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
      {
                expires      30d;
      }

      location ~ .*\.(js|css)?$
      {
                expires      12h;
      }

      location ~ /.well-known {
                allow all;
      }

      location ~ /\.
      {
                deny all;
      }

      access_log/home/wwwlogs/www.mysite.com.log;
        }

大佬 按照你这个配置 真的有问题 。你去测试下。我看着语法也没问题。就是不行。。。。yc002t

march1993 发表于 2018-5-1 22:52:04

akige 发表于 2018-5-1 22:45
大佬 按照你这个配置 真的有问题 。你去测试下。我看着语法也没问题。就是不行。。。。 ...

怎么感觉是你firefox的缓存 ,换个浏览器或者硬清空缓存试试看
还有 firefox的跳转记录也可以发上来
页: 1 [2] 3
查看完整版本: http强制跳到 https带www nginx配置问题,大佬看下哪的问题