Ich habe eine nginx.conf:
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name localhost;
resolver 172.31.0.2;
set $proxy_pass_url https://my-url.com;
# redirect /kibana
location = /kibana {
rewrite ^ /_plugin/kibana redirect;
}
location / {
proxy_pass $proxy_pass_url;
auth_basic "Username and Password are required";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_set_header Authorization "";
proxy_hide_header Authorization;
}
include /etc/nginx/conf.d/*.conf;
}
}
Ich versuche, ein Set zu setzen, proxy_pass_url
um es später in der conf-Datei zu verwenden. Warum ich das Set verwende, wird erklärtHier.
Aber ich bekomme immer wieder:
invalid number of arguments in "set" directive in /etc/nginx/nginx.conf
Was mache ich falsch? Wie kann ich eine Variable in nginx setzen? Ich habe auch versuchtset $proxy_pass_url "https://my-url.com";