nginx:emerg:未知的“ request_url”变量

时间:2019-08-18 08:31:50

标签: nginx digital-ocean ubuntu-18.04

我试图在Digital Ocean的Droplet上的Ubuntu上配置Nginx服务器。

运行sudo nginx -t时出现错误

[emerg] unknown "request_url" variable,还说了一些有关etc / nginx / nginx.conf文件的内容,但在以下文件的任何地方都看不到“ request_url”。

这是我的default配置文件

# Enforce HTTPS
server {
    listen 80;
    listen [::]:80;
    return 301 https://$host$request_uri;
}

# Proxy all requests to Node
server {
    # Enable HTTP/2
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name api.storybook.space;

    # Use the Let's Encrypt certificates
    ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;

    # Include the SSL configuration from cipherli.st
    include snippets/ssl-params.conf;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://localhost:5000/;
        proxy_ssl_session_reuse off;
        proxy_set_header Host $http_host;
        proxy_cache_bypass $http_upgrade;
        proxy_redirect off;
    }
}

我试图寻找有关此问题的答案,但是没有一个可以解决我的问题。

有人可以指出正确的方向吗?

1 个答案:

答案 0 :(得分:1)

使其正常工作。

似乎与缓存有关(可能不是正确的词),等等。 我创建了一个新的VM,并对其执行了相同的步骤。在没有SSL的情况下均可完美运行。

以前,在进行此设置时,我不小心输入了<cfset valuesToTest = [ "1234567890", "123-4567-890", "+1234567890", "+123-4567-890", "123", "12345678901234567890", " 1234567890#chr(9)#" ]> <cfoutput> <cfloop array="#valuesToTest#" index="value"> <cfset newValue = StandardPhoneNumber(value)> #value# = #newValue# (length: #len(newValue)#)<br> </cfloop> </cfoutput> <cffunction name="StandardPhoneNumber" access="public" hint="Returns a 10 digit phone number in a numeric format ex. 8883334444" Description="We use a standard numeric only phone number. We stripped the non numeric characters and return 10 digit"> <cfargument name="phoneNumber" required="true"> <cfset local.phoneNumber = right(REReplace(arguments.phoneNumber, "[^0-9]", "", "ALL"), 10)> <cfreturn local.phoneNumber> </cffunction> 而不是$host$request_url,从那时起,我一直收到此错误消息

希望有帮助!