当我在网络浏览器中输入https://myBuyDomain时加载网页时,它会更改为 https://my_Ip_static
- 服务器工作正常,使用ssl,但我总是通过静态ip访问
- 自签名 CA、Apache2、Debian 9,使用 Google 计算引擎。
- 唯一的变化是购买域名,我设置的重定向是:https://mi_ip_static
- 我的域名:zzzzzz.page 和 www.zzzzzz.page
- 我不使用任何 .htaccess
-虚拟主机
<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>
- /etc/主机
my_ip_static zzzzzz.page www.zzzzzz.page 127.0.0.1 本地主机主机名_机器 ::1 本地主机 ip6-本地主机 ip6-环回 ff02::1 ip6-所有节点 ff02::2 ip6-所有路由器 xxx.xxx.xxx.xxx aaaaa.aaaa.a.aaaaa.aaaaa old_hostname # 由 Google 添加 xxx.xxx.xxx.xxmetadata.google.internal # 由 Google 添加
此外,当我尝试安装 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 ?我不知道我做错了什么或者还有什么需要配置。
最佳答案
该错误出现在 Google 域配置中。我创建了一个网站的重定向。此选项是重定向到外部网站,但不重定向到您自己的服务器。
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更改域名
关于linux - 浏览器通过ip更改域名,Debian,Apache2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55052743/