当 http 到域

我想在带有域的 ec2 上使用 Nginx 提供静态 HTML 文件。

但是当 HTTP 到域时我看不到任何东西,而当 HTTP 到 ec2 的 ipv4 时我可以看到我的 HTML 文件被提供。

步骤:

  • 我购买了一个域 + 我在 AWS 上创建了一个 ec2 + 创建托管区域 + 创建将我的 ec2 ipv4 地址链接到我的域的记录 + dnschecker 显示我的域指向 ec2
  • 我在 ec2 上安装 Nginx + 创建一个如下所示的配置文件
  • HTML 文件路径为:/etc/nginx/html/index.html

感谢任何帮助。谢谢。

自定义配置文件:

server {
        listen 80;
        server_name mydomain.here www.mydomain.here;
        root /etc/nginx/html;

        location / {
                index index.html;
        }
}

默认 nginx.conf 文件:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$document_root$document_uri" "$request"'
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

poruin 回答:当 http 到域

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/480.html

大家都在问