从nginx配置中删除https重定向无法正常工作

时间:2017-11-01 18:09:36

标签: nginx

我在nginx conf

中更改了以下行
listen 80 default_server;
server_name _;

listen 80 default_server;
server_name mydomain.com;
return 301 https://server_name$request_uri;

我已经删除了重定向到https更改,但是nginx仍然将我的请求重定向到当前不支持的https。我该如何改回来?

我的其余nginx conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
        worker_connections 768;
}

http {

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;


        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip on;
        gzip_disable "msie6";

        server {
                listen 80 default_server;
                server_name _;

                location / {
                        include uwsgi_params;
                        uwsgi_pass 127.0.0.1:8000;
                        uwsgi_buffer_size 8192;
                        uwsgi_buffering on;
                }

                location ~ [^/]\.php(/|$) {
                        root        /opt;
                        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                        if (!-f $document_root$fastcgi_script_name) {
                        return 404;
                }

                fastcgi_param HTTP_PROXY "";
                fastcgi_read_timeout 150;
                fastcgi_buffers 4 256k;
                fastcgi_buffer_size 128k;
                fastcgi_busy_buffers_size 256k;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

                #include /etc/nginx/conf.d/*.conf;

       }
}

是否还需要检查其他设置?

1 个答案:

答案 0 :(得分:0)

由于使用了3​​01,这是一个浏览器缓存问题。

以隐身方式打开网址,他们工作正常。