去部署一个项目 - 通过 EC2 租用了一个 Amazon Linux 2 AMI。通过 SSH 连接到机器,通过 sudo yum update
应用更新,然后通过 sudo amazon-linux-extras install nginx1
安装 NGINX。使用 sudo systemctl start nginx
启动 NGINX,我看到了这一点
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2021-06-02 04:36:12 UTC; 1min 16s ago
Process: 7635 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 7631 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 7629 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 7637 (nginx)
CGroup: /system.slice/nginx.service
├─7637 nginx: master process /usr/sbin/nginx
└─7638 nginx: worker process
到目前为止一切顺利。前往我的实例的安全组并设置一个 HTTP 协议,该协议设置为 ANYWHERE 作为选项。重新启动 NGINX,当我转到我的实例公共 IPv4 地址时,它只是没有加载我期望从 NGINX 获得的默认页面。它只是拒绝连接并超时。我继续卷曲我的 IPv4 地址,它确实显示了我期望的默认 NGINX 页面的 HTML。我只是不知道为什么我转到 IP 地址时无法连接。