使URL看起来更好

时间:2015-04-06 01:42:45

标签: url nginx

我刚才使用Nginx,所以目前我的默认文件中有这个。

 location / {
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $remote_addr;
           proxy_set_header Host $host;
           proxy_pass http://127.0.0.1:3000;
        }

    location /templates/ {
              autoindex on;
              root /home/user/go/src/app/;
            }

所以我的网址看起来像下面的链接,具体取决于我在哪个页面:

http://localhost:80/templates/index.html

如何让Nginx重新格式化我的网址,如下所示:

http://localhost:80/index.html

1 个答案:

答案 0 :(得分:0)

您必须像这样添加位置块

location / {
          # ...
          root /home/user/go/src/app/;
}

有关地点here

的更多信息
相关问题