为什么我的凭据没有传递到我的 nginx.conf 中? [英] Why aren't my creds being passed into my nginx.conf?
本文介绍了为什么我的凭据没有传递到我的 nginx.conf 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我原来的nginx.conf:
My original 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 启动时不起作用.
But this wont work when nginx starts.
推荐答案
使用 .conf
作为文件结尾在某些情况下不起作用.这应该会给你一个错误,试图在 configtest 上重新加载 nginx sudo nginx -s reload
或 nginx -t
.这取决于您的 nginx.conf.检查是否有任何 include
指令,包括给定目录中的任何 *.conf
.
Using .conf
as a file ending will not work in some cases. This should give you an error trying to reload nginx sudo nginx -s reload
or nginx -t
on configtest. This depends on your nginx.conf. Check if there is any include
directive including anything *.conf
from a given directory.
使用这个
凭证.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];
}
}
}
这篇关于为什么我的凭据没有传递到我的 nginx.conf 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文