2017-07-10 35 views
0

我有一个超级简单的虚拟主机虚拟主机应该工作。我一直在研究这个好几个小时,而且我很茫然,没有理由不应该这样做。我在17.04 Ubuntu和最新的nginx,Nginx的虚拟主机文件不工作

server { 
    listen 80; 
    server_name utig.me; 

    access_log /var/www/html/utig/logs/access.log; 
    error_log /var/www/html/utig/logs/error.log; 

    location/{ 
     root /var/www/html/utig/public/; 
     index index.html; 
    } 
} 

任何人都知道为什么这不工作?我只是得到默认的“Welcome to nginx”消息。

+0

'index'移动加工出来其中'没有定义root'的'location'块。 – Deadooshka

+0

“不工作”是指什么?你做什么,你期望什么,你会得到什么? –

+0

我解释了我的问题,请在回答之前阅读整个问题。 Anwyay,现在已经修复了。 – PiggyPiglet

回答

1

尝试这样的:

server { 
    listen 80; 
    server_name utig.me; 

    root /var/www/html/utig/public/; 
    index index.html; 

    access_log /var/www/html/utig/logs/access.log; 
    error_log /var/www/html/utig/logs/error.log; 

    location/{ 
     try_files $uri $uri/ /index.html; 
    } 
} 
+0

谢谢,它修复了它。我的另一个问题是我需要从站点建立符号链接 - 可用于启用站点。 – PiggyPiglet