nginx server_name wildcard or catch-all

前端 未结 7 744
长情又很酷
长情又很酷 2020-12-04 06:57

I have an instance of nginx running which serves several websites. The first is a status message on the server\'s IP address. The second is an admin console on admin.d

7条回答
  •  不知归路
    2020-12-04 07:28

    Change listen option to this in your catch-all server block. (Add default_server) this will take all your non-defined connections (on the specified port).

    listen       80  default_server;
    

    if you want to push everything to index.php if the file or folder does not exist;

    try_files                       $uri /$uri /index.php;
    

    Per the docs, It can also be set explicitly which server should be default, with the **default_server** parameter in the listen directive

提交回复
热议问题