How can I list all vhosts in nginx

2020-05-25 03:51发布

Is there a command that will list all vhosts or servers running under nginx on CentOS? I would like to pipe the results to a text file for reporting purposes.

I'm looking for something similar to this command that I use for Apache:

apachectl -S 2>&1 | grep 'port 80'

7条回答
霸刀☆藐视天下
2楼-- · 2020-05-25 04:55

starting from version 1.9.2 you can do:

nginx -T

show complete nginx configuration

nginx -T | grep "server_name " #include the whitespace to exclude non relevant results

show you all server names

查看更多
登录 后发表回答