2017-03-08 550 views
0

我在Ubuntu 14.04.5服務器上運行Nginx。我試圖建立一個新的服務器塊,但是當我瀏覽到的URL我看到這個錯誤:Nginx服務器塊ERR_NAME_NOT_RESOLVED

Nginx server block error

我給這家虛擬主機配置如下。

,我想我的子域名指向的目錄是/var/www/vhosts/ny-video.splashpreviews.com

/etc/nginx/sites-available是我的服務器塊文件。該文件的服務器配置部分低於:

server { 
listen *:80; 
listen [::]:80; 

root /var/www/vhosts/ny-video.splashpreviews.com; 
index index.php index.html index.htm; 

# Make site accessible from http://localhost/ 
server_name ny-video.splashpreviews.com; 
} 

我再啓用服務器模塊並重新啓動Nginx的。有什麼我在過程中失蹤或我做錯了,導致這不起作用?任何指導將不勝感激。謝謝。

+1

您是否爲主機名添加了DNS條目?看來你沒有。 –

+0

謝謝。我添加了DNS條目,現在它顯示「Web服務器的默認頁面」,所以它仍然不起作用。我在設置中缺少什麼? – Liz

回答

1

您需要將splashpreviews.com網站添加到配置並允許服務器的位置。可以有幾個location部分,限制對每個子目錄的訪問。

http { 
    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; 
    include  /etc/nginx/mime.types; 
    .... 
    server { 
    listen 80; 
    server_name splashpreviews.com www.splashpreviews.com; 
    location/{ 
     allow all; 
    } 
    .... 
    } 
    server { 
    listen 80; 
    server_name ny-video.sp.com; 
    location/{ 
     allow all; 
    } 
+0

我試着將此添加到我的配置中,但我的域仍顯示「Web服務器的默認頁面」http://ny-video.splashpreviews.com/。我在設置中丟失了一些重要的東西嗎? – Liz

+0

是的。將ny-viedo ...添加到server_name中的域列表中 – ETech

+0

現在我看到以下消息:歡迎使用nginx!如果您看到此頁面,則說明nginx Web服務器已成功安裝並正常工作。需要進一步的配置。有關在線文檔和支持,請參閱nginx.org。商業支持可在nginx.com上找到。 感謝您使用nginx。 – Liz