如何解决为什么我的凭据没有传递到我的 nginx.conf 中?
我原来的nginx.conf:
events {}
http {
server {
include credentials.conf;
listen 80;
location / {
proxy_set_header Authorization $credentials;
proxy_pass [website_of_choice];
}
}
}
我credentials.conf:
set $credentials 'Basic [long_encoded_login_details]';
但这在 nginx 启动时不起作用。
解决方法
使用 .conf
作为文件结尾在某些情况下不起作用。这应该会给您一个错误,尝试在 configtest 上重新加载 nginx sudo nginx -s reload
或 nginx -t
。这取决于您的 nginx.conf。检查是否有任何 include
指令,包括给定目录中的任何 *.conf
。
使用这个
credentials.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];
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。