欢迎光临
我们一直在努力

ubuntu – 无法从Nginx中删除强制HTTPS重定向?

本站教程收集整理的这篇文章主要介绍了ubuntu – 无法从Nginx中删除强制HTTPS重定向?,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。

我最初设置了我的Nginx配置,以自动将http重定向到https.由于我的工作安全策略和CloudFlare集成,httpS无法在我的网络内解析.

我只想删除强制重定向到https.但在使用URI重写注释掉块之后,服务器仍会自动重定向.

这是我对Nginx的默认配置

#httpS redirect (if necessary)
#server {
#       listen      80;
#       server_name example.com;
#       rewrite     ^   https://$server_name$request_uri? peRMANent;
#}

server {
        listen 80;
        listen [::]:80 default_server ipv6only=on;
        listen 443 ssl spdy;
        root /var/www/example/current/PUBLIC;
        index index.php index.html index.htm;

        spdy_chunk_size 8k;
        spdy_headers_comp 7;

        server_name example.com;
        # Point to ssl certificates
        ssl_certificate /root/example.com.crt;
        ssl_certificate_key /root/example.com.key;
        # 美国高防vps Allow only secure TLS protocols
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        #ssl_prefer_server_ciphers on;
        #ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;

        ssl on;

        # Set the buffer size to 1400 bytes (that way it fits into a single MTU$
        ssl_buffer_size 1400;
#       add_header Strict-Transport-Security max-age=63072000;

        gzip on;
        gzip_min_length 1280;
        gzip_buffers    16 8k;
        gzip_comp_level 4;
        gzip_http_version 1.0;
        gzip_types    text/plain text/html text/css application/javascript appl$
        gzip_vary on;

        LOCATIOn / {
                # First attempt to serve request as file,then
                # as directory,then fall BACk to displaying a 404.
                try_files $uri $uri/ /index.php$is_args$args;
        }

        # pass the php scripts to FastCGI server listening on /var/run/php5-fpm$
        LOCATIOn ~ \.php${
                try_files $uri /index.php =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILename $document_root$fastcgi_script_nam$
                include fastcgi_params;
        }

        LOCATIOn ~* \.(css|js|gif|jpe?g|png|woff2?)${
                #gzip on;
                #gzip_vary on;
                expires 168h;
                add_header Pragma PUBLIC;
                add_header Cache-Control "public,must-revalidate,proxy-revali$
                add_header vary "Accept-Encoding";
        }

        #include /etc/Nginx/global/*;
}

任何帮助将不胜感激!谢谢.

首先,删除ssl;

其次,你有Strict-Transport-Security标题和浏览器记住了2年(正如标题所说的那样).使用max-age = 0添加它以删除效果.

如果您不能这样做(或希望立即生效),请从浏览器中清除HSTS,如this article所说.

本站总结

以上是本站教程为你收集整理的ubuntu – 无法从Nginx中删除强制HTTPS重定向?全部内容,希望文章能够帮你解决ubuntu – 无法从Nginx中删除强制HTTPS重定向?所遇到的程序开发问题。

如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。