I have an 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;
}
}
I try to set an proxy_pass_url
to use it later in the conf file. Why I'm using the set is explained here.
But I keep getting:
invalid number of arguments in "set" directive in /etc/nginx/nginx.conf
What am I doing wrong? How can I set a variable in nginx? I also tried set $proxy_pass_url "https://my-url.com";
0 Answers