首页  >  问答  >  正文

nginx 怎么根据不同子域名对应不同目录的资源文件 ?

例如:a.example.com/index.html 对应 /a-direcoty/index.html,而b.example.com/index.html 对应 /b-direcoty/index.html

黄舟黄舟2713 天前649

全部回复(2)我来回复

  • 给我你的怀抱

    给我你的怀抱2017-05-16 17:14:52

    雷雷

    回复
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 17:14:52

    nginx配置文件可以设置server段,在server中设置server_name来指定域名。所以你这种情况就设置两个server,分别是两个域名,然后再设置root为具体目录

    回复
    0
  • 取消回复