简体   繁体   English

Nginx虚拟主机文件不起作用

[英]Nginx vhost file not working

I have a super simple nginx vhost that should work. 我有一个应该能正常工作的超级简单的nginx虚拟主机。 I've been researching this for hours and I am seriously at a loss, there's no reason this shouldn't work. 我已经研究了好几个小时,但我实在很茫然,没有理由不起作用。 I'm on 17.04 ubuntu and the latest nginx, 我正在使用17.04 ubuntu和最新的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;
    }
}

Anyone have a clue why this isn't working? 有人知道为什么这行不通吗? I just get the default "Welcome to nginx" message. 我只是得到默认的“ Welcome to nginx”消息。

Try like this: 尝试这样:

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;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM