【问题标题】:Nginx respond only to localhost: but not to server_nameNginx 只响应 localhost: 但不响应 server_name
【发布时间】:2020-07-22 14:36:00
【问题描述】:

在发现 nginx 时(使用本导师 https://www.digitalocean.com/community/tutorials/nginx-ubuntu-18-04-ru)在“第 5 步 - 设置服务器块(推荐)”中遇到了问题。这是我的服务器块文件。

server {
       listen 81;
       listen [::]:81;

       root /var/www/tutorial;
       index index.html;
       server_name example.ubuntu.com;
       location / {
               try_files $uri $uri/ =404;
       }
}

但 nginx 只响应 localhost:81 查询,而不是 example.ubuntu.com

【问题讨论】:

  • 因为你告诉它监听 81 端口。

标签: ubuntu nginx vmware


【解决方案1】:

最后,我通过我的域名从服务器获得响应。问题在于我的无能。我盲目地遵循上述教程,其中没有关于“主机”文件的附加配置的步骤。这正是唯一必要的步骤......

【讨论】:

    猜你喜欢
    • 2018-12-01
    • 1970-01-01
    • 2018-08-01
    • 1970-01-01
    • 2011-01-30
    • 2017-01-08
    • 2016-03-02
    • 2012-05-15
    • 1970-01-01
    相关资源
    最近更新 更多