繁体   English   中英

为什么我的信用没有被传递到我的 nginx.conf 中?

[英]Why aren't my creds being passed into my nginx.conf?

我原来的 nginx.conf:

events {}
http {
    server {
    include credentials.conf; 
        listen 80;
        location / {
            proxy_set_header Authorization $credentials;
            proxy_pass [website_of_choice];
        }
    }
}

我的凭据.conf:

set $credentials 'Basic [long_encoded_login_details]';

但这在 nginx 启动时不起作用。

在某些情况下,使用.conf作为文件结尾将不起作用。 这应该会给您一个错误,尝试重新加载 nginx sudo nginx -s reloadnginx -t on configtest。 这取决于您的 nginx.conf。 检查是否有任何include指令,包括给定目录中的任何*.conf内容。

用这个

凭据.include

set $credentials 'Basic [long_encoded_login_details]';

nginx.conf

events {}
http {
    server {
    include credentials.include; 
        listen 80;
        location / {
            proxy_set_header Authorization $credentials;
            proxy_pass [website_of_choice];
        }
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM