Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何修复nginx上http 414请求URI过大的错误?_Javascript_Http_Nginx_Https - Fatal编程技术网

Javascript 如何修复nginx上http 414请求URI过大的错误?

Javascript 如何修复nginx上http 414请求URI过大的错误?,javascript,http,nginx,https,Javascript,Http,Nginx,Https,我希望所有到我的web服务器的流量都被重定向到Nginx上的https。然而,当我访问我的网站时,我得到了一个错误“414请求URI太大”,URL长得离谱--:--它持续了一段时间,我假设这就是导致我出现这个错误的原因。但是我不知道如何修复这个重定向错误,因为我的Nginx配置文件不包含$request\u uri参数 以下是Nginx配置文件: server { server_name example.com; return 301 https://www.example.c

我希望所有到我的web服务器的流量都被重定向到Nginx上的https。然而,当我访问我的网站时,我得到了一个错误“414请求URI太大”,URL长得离谱--:--它持续了一段时间,我假设这就是导致我出现这个错误的原因。但是我不知道如何修复这个重定向错误,因为我的Nginx配置文件不包含
$request\u uri
参数

以下是Nginx配置文件:

server {
    server_name  example.com;
    return 301 https://www.example.com;

listen 443 ssl; 
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; 
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; 
include /etc/letsencrypt/options-ssl-nginx.conf; 
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; 
}

server {
 root /var/www/html;
 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name www.example.com;
    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            proxy_pass http://localhost:8080; #whatever port your app runs on
            proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;      
        }
    }

  
server {
  if ($host = www.example.com) {
     return 301 https://www.example.com;
  } 


  if ($host = example.com) {
    return 301 https://www.example.com;
  } 
  listen 80 default_server;
  server_name  example.com www.example.com;
  return 404; 
}

任何帮助都将不胜感激

我知道这是一个老生常谈的问题,但对于任何寻求解决方案的人来说,从我的浏览器中清除缓存和cookies是一种有效的方法

  • 打开Chrome,在右上角,单击三个垂直点图标
  • 单击更多工具,然后清除浏览数据
  • 在顶部,选择一个时间范围。(对我来说,我在最后一个小时删除了)
  • 单击清除数据

  • 我知道这是一个老问题,但对于任何寻求解决方案的人来说,从我的浏览器中清除缓存和cookies是一种有效的方法

  • 打开Chrome,在右上角,单击三个垂直点图标
  • 单击更多工具,然后清除浏览数据
  • 在顶部,选择一个时间范围。(对我来说,我在最后一个小时删除了)
  • 单击清除数据

  • 这是否回答了您的问题?嗯,那是另一个问题。我只是不知道是什么导致服务器永远重定向,直到它达到http的限制。当你注释掉代理指令时,这种情况还会发生吗?只是一个猜测,但我有一次在Apache上遇到过这样的情况:奇怪的重定向是通过代理实现的。你解决了吗@麦克斯格特内尔这能回答你的问题吗?嗯,那是另一个问题。我只是不知道是什么导致服务器永远重定向,直到它达到http的限制。当你注释掉代理指令时,这种情况还会发生吗?只是一个猜测,但我有一次在Apache上遇到过这样的情况:奇怪的重定向是通过代理实现的。你解决了吗@马克斯格特纳