根据Nginx wiki,该$hostname
变量设置为 gethostname 返回的机器主机名。
我试过了,虽然gethostname
我的 Debian 盒子不起作用,但它仍然正确地返回主机。然后我尝试使用该变量$hostname
来设置server_name
,但这不起作用。
为什么会这样,还有其他方法可以实现吗?
server {
listen 80;
autoindex off;
server_name static.$hostname;
root /var/www/static;
access_log /var/log/nginx/localhost.access.log;
location / {
index index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}
Run Code Online (Sandbox Code Playgroud) IP 不再响应远程 ping
重启我的意思是:
lxc-stop -n vm3
lxc-start -n vm3 -f /etc/lxc/vm3.conf -d
Run Code Online (Sandbox Code Playgroud)
——
/etc/网络/接口
auto lo
iface lo inet loopback
up route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
down route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
# device: eth0
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.22.189.58
netmask 255.255.255.248
gateway 192.22.189.57
broadcast 192.22.189.63
bridge_ports eth0
bridge_fd 0
bridge_hello 2
bridge_maxage 12
bridge_stp off
post-up ip route add 192.22.189.59 dev br0
post-up …
Run Code Online (Sandbox Code Playgroud)