使用nginx服务静态页面 – 获取404

我试图用nginx在我的网站上设置一个静态页面。 该文件夹有一个index.html文件以及一些静态文件。

目录结构看起来像这样

 olx --static --fonts --index.html 

这是我想如何服务index.html页面。

 location /olx { root /mypath/olx; default_type "text/html"; try_files $uri $uri.html $uri/index.html index.html; } 

这给了我一个404错误。 任何帮助?

问题在这里:

 location /olx { root /mypath/olx; 

将其更改为:

 location /olx { root /mypath;