首页 > 解决方案 > 浏览器通过ip,Debian,Apache2更改域

问题描述

当我在加载网络时在网络浏览器中输入https://myBuyDomain时,它会更改为https://my_Ip_static

-虚拟主机

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /miPath/web
    ServerName zzzzzz.page
    ServerAlias www.zzzzzz.page

    <Directory /miPath/web>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
    </FilesMatch>

    SSLCertificateFile      /otherPath.pem
    SSLCertificateKeyFile /otherPath.key
</VirtualHost>

此外,当我尝试安装 certbot 时,但由于我不知道在哪里更改而失败:

Fetching https://my_ip_static: Invalid host in redirect target "my_ip_static". 
Only domain names are supported, not IP addresses

正确的做法是使用 .htaccess 更改域的 my_ip_static?我不知道我做错了什么或者还有什么需要配置的。

标签: linuxnetworkingdnsipapache2

解决方案


错误在谷歌域配置中。我创建了一个指向网站的重定向。此选项用于重定向到外部网站,而不是您自己的服务器。

1 - 删除网站重定向

2 - 在 DNS 部分,创建 2 个自定义资源记录

第一的:

     name = @
     Type = A
     TTL = 1h
     Data = static ip of my server

第二:

     name = www
     Type = A
     TTL = 1h
     Data = static ip of my server

就是这样,几分钟后服务器就可以访问了,并且不会通过ip更改域名


推荐阅读