NGINX错误“参数太长”

时间:2015-10-18 16:29:24

标签: nginx module

我似乎无法找到为什么NGINX一直说“参数太长,也许你错过了”'“?”

我当前的配置在这里:

user  root;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
worker_connections  1024;
}


http {
server_tokens off;

#default config, module disabled
testcookie on;

#setting cookie name
testcookie_name 'warmservers_ConnectID';

#setting secret
testcookie_secret super0219834098ascnmju309m1m030iSSSSSSEECRET;

#setting session key
testcookie_session $remote_addr;

#setting argument name
testcookie_arg '';

#setting maximum number of cookie setting attempts
testcookie_max_attempts 1;

#setting p3p policy
testcookie_p3p 'CP="CUR ADM OUR NOR STA NID", policyref="/w3c/p3p.xml"';


#setting redirect via html code
testcookie_redirect_via_refresh on;

#enable encryption
testcookie_refresh_encrypt_cookie on;

#setting encryption key
testcookie_refresh_encrypt_cookie_key random;

#setting encryption iv
testcookie_refresh_encrypt_cookie_iv random2;



testcookie_refresh_template '
<html lang="en-US" class=""><head>
    <meta http-equiv="Content-Type"    content="text/html; charset=UTF-8">
<title>Please wait...</title>
<meta name="description" content="">
    <meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<style>
  html, body {
    background: #fff;
    color: #FAFAFA;
    margin-top: 10%;
    font-family: "Roboto"; }

  img.brand {
    display: block;
    opacity: .95;
    max-height: 85px;
    margin: 0 auto;
    opacity: .80; }

  h1.message {
    text-align: center;
    margin-top: 45px;
    font-weight: 100;
    font-size: 20px;
   //  text-transform: uppercase;
    opacity: .9;
    color: #E0E0E0;
    line-height: 30px; }
    h1.message a:link {
      text-decoration: none;
      color: #E0E0E0;
      font-weight: 300; }

  span.loading {
    text-align: center;
    display: block;
    font-size: 45px;
    margin-top: 45px;
    color: rgba(250, 250, 250, 0.5);
</style>
</head>
  <body>

<div class="container">
 <div class="row">
    <div class="col-sm-12">
        <span class="icon" style="display: block; opacity: 0.631937;">
            <a href="https://www.example.com" target="_blank">


 <img src="data:image/png;base64,..." class="img-responsive brand"></a>
            </span>
    </div>
    <div class="col-sm-12">
        <h1 class="message"><a href="https://www.example.com" target="_blank"><font color="#000">Please wait - we are checking your browser...<font color="#000"></font></a></h1>
    </div>
    </div>
  </div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"</script>

<script>
function load() {
    setTimeout(function() {
                    $("span.icon")fadeOut("fast").fadeIn("fast");
        load();
    }, 0);
}

load();

// remember, these are the possible parameters for Set_Cookie:
// name, value, expires, path, domain, secure
Set_Cookie( "test", "none", "", "/", "", "" );
// if Get_Cookie succeeds, cookies are.    enabled, since
//the cookie was successfully created.
if ( Get_Cookie( "test" ) )
{
    /* do nothing */
    /*
    this is an example of a set cookie variable, if
    you want to use this on the page or on another script
    instead of writing to the page you would just check that value
    for true or false and then do what you need to do.
    */
    cookie_set = true;
    // and these are the parameters for Delete_Cookie:
    // name, path, domain
    // make sure you use the same parameters in Set and Delete Cookie.
    Delete_Cookie("test", "/", "");
}
// if the Get_Cookie test fails,    cookies
//are not enabled for this session.
else
{
    die_now("Your browser is blocked. Please try again later. ");
    cookie_set = false;
}
</script></body></html>';

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

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                   '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

 server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
#server {
#    listen       443 ssl;
#    server_name  localhost;

#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;
#    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers  on;

#    location / {
#        root   html;
#        index  index.html   index.htm;
#    }
#}

include conf.d/*;

}

我将以下模块编译成NGINX:

  • testcookie
  • 吹扫

无论如何,如果有人知道为什么这样做会很有帮助。

1 个答案:

答案 0 :(得分:0)

你的意思是:`参数太长,可能缺少终止&#34; X&#34;字符?

这意味着您已超过配置值允许的长度。可能是由于testcookie_refresh_template选项的长度。

将其简化为非常简单的功能,然后慢慢构建,直到找到导致问题的点为止。

相关的源代码在这里:ngx_conf_file.c