nginx server_name 多个
nginx server_name 多个的话,空格隔开就行
server_name baidu.com baidu.me;1
如果很多的话可以用正则,我的需求,xxx-api-dev.zzg.me 统一跳转到127.0.0.1:8888
server { listen 80; server_name ~^.+-api-dev.zzg.me$; location / { #error_log /var/log/nginx/x-api-dev.1yd.me.error.log debug; #access_log /var/log/nginx/x-api-dev.1yd.me.access.log; #rewrite_log on; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:8888; }
赞 (0)