2016-11-14 107 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

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