【问题标题】:When I go to the my domain name it goes to my app but just shows the IP address in the address bar当我转到我的域名时,它会转到我的应用程序,但只在地址栏中显示 IP 地址
【发布时间】:2021-05-20 14:22:40
【问题描述】:

我有一个 react 构建,我在 vps 上的 nginx 服务器上提供服务,其中包含 contabo 和托管在 godaddy 上的域名。 我更改了godaddy 中的A 记录以指向我的vps ip 我将名称服务器从godaddys 切换到我的vps,它按应有的方式加载应用程序,但域名被替换为服务器的IP 地址。请告诉我如何解决这个问题

为 nginx 启用的站点是

server {
      listen 443 ssl;
    listen [::]:443 ssl;

  include snippets/self-signed.conf;
  include snippets/ssl-params.conf;

  server_name blockface.fun;
  root /var/www/blockface.fun/html;
  index index.html;

  access_log /var/log/nginx/blockface.fun.access.log;
  error_log /var/log/nginx/blockface.fun.error.log;
  location / {
                #...
                try_files $uri $uri/ /index.html$is_args$args;
                #...  
    }
}
server {
    listen 80;
    listen [::]:80;

    server_name example.com www.example.com;

    return 302 https://$server_name$request_uri;
}

当我运行 sudo ufw app list 时

Available applications:
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  OpenSSH

【问题讨论】:

    标签: reactjs ubuntu nginx


    【解决方案1】:

    转到 contabo 中的 DNS 区域管理: 将列出 3 个命名服务器,请确保针对您的 godaddy 域添加所有服务器(假设您已经这样做了)。 然后确保您的域的 FQDN 是 blockface.fun(在下面的部分中,如果您添加了域,您应该会看到它列出 - 如果您没有添加它),如果这就是您想要的。 另一个建议(虽然没有被问到): 代替 示例.com www.example.com; 和 块面.funwww.blockface.fun 在您启用网站的文件中

    【讨论】:

      猜你喜欢
      • 2016-04-18
      • 2014-01-26
      • 1970-01-01
      • 2017-07-07
      • 1970-01-01
      • 2013-05-21
      • 1970-01-01
      • 2018-09-10
      • 1970-01-01
      相关资源
      最近更新 更多