Opened 6 months ago

Last modified 5 months ago

#1775 new enhancement

Allow $hostname as part of name in server_name

Reported by: bes.internal@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.15.x
Keywords: Cc:
uname -a:
nginx -V: nginx version: nginx/1.16.0 built with OpenSSL 1.1.1b 26 Feb 2019 TLS SNI support enabled configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib64 --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=/var/lib/nginx/tmp/client --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-http_v2_module --with-pcre --with-pcre-jit --with-threads --without-http_grpc_module --without-http_memcached_module --without-http_mirror_module --without-http_scgi_module --without-http_split_clients_module --without-http_upstream_hash_module --without-http_upstream_ip_hash_module --without-http_upstream_keepalive_module --without-http_upstream_least_conn_module --without-http_upstream_zone_module --without-http_uwsgi_module --with-http_addition_module --with-http_auth_request_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_perl_module --with-http_realip_module --with-http_stub_status_module --with-http_sub_module --with-http_realip_module --add-module=external_module/headers-more-nginx-module-0.33 --add-module=external_module/echo-nginx-module-0.61 --add-module=external_module/ngx_http_geoip2_module-3.2 --add-module=external_module/ngx_brotli-8104036af9cff4b1d34f22d00ba857e2a93a243c --with-http_ssl_module --without-stream_access_module --without-stream_geo_module --without-stream_limit_conn_module --without-stream_map_module --without-stream_return_module --without-stream_split_clients_module --without-stream_upstream_hash_module --without-stream_upstream_least_conn_module --without-stream_upstream_zone_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --user=nginx --group=nginx

Description

From https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name :

If the directive’s parameter is set to “$hostname” (0.9.4), the machine’s hostname is inserted.

Once nginx's $hostname variable is known at the time of launch, can we use it to compile the full name of the server name? For example:

server_name static.$hostname
server_name $hostname.example.com

Change History (1)

comment:1 Changed 5 months ago by maxim

  • Milestone nginx-1.17.0 deleted

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.