Nginx服务器块不起作用。非常简单的情况。

时间:2013-11-26 13:36:12

标签: nginx

我的配置文件中有这个块:

   server {
     listen 80;
    server_name test;
    root d:/pathto/test/;
  }

在我的localhosts文件中,我将DNS设置为127.0.0.1。这样可行。将显示Nginx主页。 (因此localhosts文件的一部分工作)。但是“虚拟主机”无法正常工作。我仍然得到主要的“虚拟主机” - 默认的Nginx页面。我尝试过最简单的案例。我看不出问题。可能是什么问题?

这是在Windows 8上。

由于

- Justin Wyllie

1 个答案:

答案 0 :(得分:0)

您称之为“虚拟主机?为子文件夹添加位置:

http{
      server {
         listen 80;
        server_name test;
        root d:/pathto/test/;
        location / {
           index index.php index.htm index.html;
        }
      }
}
相关问题