ubuntu - DigitalOcean NGINX 服务器 block 上的请求超时

标签 ubuntu nginx server digital-ocean

当我尝试在浏览器中访问 Droplet 上的任何域时,出现请求超时。 DigitalOcean 的新 Droplet 与 Ubuntu 18.04 继 Ho w To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04How to install a LEMP stack on Ubuntu 18.04

所有域都在我的 Droplet 的“网络”部分中设置。

如果我从 Mac ping 域,域名会解析为正确的 IP 地址,但请求超时。如果我在使用 SSH 登录时 ping 域,它们就会工作。

所有域的服务器 block 都设置如下:

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

    root /var/www/congressbios.com/public;
    index index.html;

    server_name congressbios.com www.congressbios.com;

    location / {
        try_files $uri $uri/ =404;
    }
}

每个域根目录的public目录下都有一个index.html文件。

运行 sudo nginx -t 显示成功

我已经重新启动了 nginx

最佳答案

我已经通过 telnet 连接到您的服务器,并且 ping 通时超时。

尝试打开端口:

sudo ufw allow http
sudo ufw allow https
sudo ufw allow echo

使用 nmap 进行服务扫描确认您已关闭端口:

$ nmap -sV congressbios.com

Starting Nmap 7.60 ( https://nmap.org ) at 2018-05-31 02:21 EEST
Nmap scan report for congressbios.com (138.68.62.22)
Host is up (0.35s latency).
Not shown: 998 filtered ports
PORT    STATE  SERVICE VERSION
22/tcp  open   ssh     OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
443/tcp closed https
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

并且仅 ssh (22) 处于打开状态:

$ telnet congressbios.com 22
Trying 138.68.62.22...
Connected to congressbios.com.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.6p1 Ubuntu-4

关于ubuntu - DigitalOcean NGINX 服务器 block 上的请求超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50614497/

相关文章:

android - 关于 PocketSphinxAndroidDemo

Apache 和 Nginx 在一起,为什么?

node.js - 从Web服务器发送请求到本地服务器

php - 攻击者有什么办法可以查看我服务器上 php 脚本中的源代码吗?

ubuntu - sudo 命令在 vagrant 中不起作用

bash - 意外 token 'fi'

java - Tomcat在内存中打开很多实例

javascript - 在 javascript 服务器端连接 MySQL,无需使用 Node.js

node.js - 生产环境中的 Socket.io 和 nginx CORS

ubuntu - 需要使用 vagrant 创建一个 ubuntu 仿生镜像 64 位服务器