linux - 浏览器通过ip,Debian,Apache2更改域
问题描述
当我在加载网络时在网络浏览器中输入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 localhost hostname_machine ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters xxx.xxx.xxx.xxx aaaaa.aaaa.a.aaaaa.aaaaa old_hostname # Added by Google xxx.xxx.xxx.xx metadata.google.internal # Added by 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?我不知道我做错了什么或者还有什么需要配置的。
解决方案
错误在谷歌域配置中。我创建了一个指向网站的重定向。此选项用于重定向到外部网站,而不是您自己的服务器。
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更改域名
推荐阅读
- visual-studio-code - 在 100% CPU 上运行的 MacOS 上的 VS Code 进程“ruby”:如何修复?
- sapui5 - 达到屏幕布局断点时使某些控件可见 - UI5
- android - Firebase“com.google.InstanceId.properties”文件生成的文件的安全问题?
- sql - 连接两个没有空值的表,反映在结果中
- ios - UIWebView 获取 SPA(单页应用)网站的当前 URL
- c - 从源代码构建库时对 CMake 中文件的未定义引用
- html - 绝对定位元素上不需要的边距
- git - Git 默认核心配置来自哪里
- excel-formula - 如何对从另外两列生成值的列使用 VLOOKUP 函数
- azure - 几分钟后无法在 Hyperledger Composer-rest-server 上获取数据,超时