2016-11-14 113 views
1

所以我使用的是数字海洋Server和我起诉LEMP构建。的Nginx服务器问题

,当我浏览到/ var/www/html等目录中,我看到附带构建的两个标准文件“的index.html”和“的index.php”。

现在我的问题是,我的Web应用程序是这样的“的index.html”文件位于下另一个子目录“DIST”结构。 (在/ var/www/html等/距离/)

如何配置Nginx的显示这个文件?

更新:

server { 
    listen 80 default_server; 
    listen [::]:80 default_server ipv6only=on; 

    root /var/www/html; 
    index index.php index.html index.htm; 

    # Make site accessible from http://localhost/ 
    servername ***.**.**.**; 

    location/{ 
      # First attempt to serve request as file, then 
      # as directory, then fall back to displaying a 404. 
      try_files $uri $uri/ =404; 
      # Uncomment to enable naxsi on this location 
      # include /etc/nginx/naxsi.rules 
    } 

    error_page 404 /404.html; 
    error_page 500 502 503 504 /50x.html; 
+0

你能告诉我们这个Web应用程序的nginx的配置? –

+0

我在哪里可以找到这个文件?对不起nginx很新... –

+0

没问题,没关系。可能在/ etc/nginx/sites-enabled /中有一个文件。它通常有'.conf'扩展名,但并不总是,如果你打开该文件夹中的文件,你可以找到一个内容如'server_name yourdomain.com',给我们发送 –

回答

2

更改这条线在你的配置

root /var/www/html; 

,并把这一

root /var/www/html/dist; 

编辑:

如果您使用基于Debian的服务器(例如Ubuntu),请在您的控制台上执行sudo service nginx reload。如果它不工作,尝试sudo service nginx restart

+0

好吧,我已经做了,但它似乎并没有工作过.. –

+0

很抱歉,请与编辑,我忘了说重启nginx的 –

+0

,完美的工作,非常感谢你! –