问题原文
原帖链接 · Rohit Gupta · CC BY-SA 4.0
I am trying to set up a domain on my development machine so that I cant test slightly more complex htaccess rules. I am trying to set up example.city domain. Following what I find by googling, I have done the following:
Windows hosts file Windows/System32/drivers/etc
127.0.0.1 example.city
127.0.0.1 www.example.city
127.0.0.1 localhost
And I have flushed the DNS cache more than 20 times by now by using
ipconfig /flushdns
When I ping example.city, I get the following, so I am confident that this part is fine.
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Next I set up the httpd-vhosts/conf file in xampp/apache/conf/extra
<VirtualHost *:80>
ServerAdmin [email omitted]
DocumentRoot "F:/xampp/htdocs/city"
ServerName example.city
ServerAlias *.example.city
ErrorLog "logs/example.city-error.log"
CustomLog "logs/example.city-access.log" common
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email omitted]
DocumentRoot "F:/xampp/htdocs"
ServerName localhost
ServerAlias *.localhost
</VirtualHost>
I stopped and started apache.
When I type in localhost/city in the browser it executes the html there.
I have flushed the browser cache and tried 2 different browsers. When I type in example.city or http://example.city, I get the following
This site can’t be reached
The webpage at
http://example.city/might be temporarily down or it may have moved permanently to a new web address.
- ERR_ADDRESS_INVALID
The two error logs files got created but are blank.
Am I not allowed to do this? Or have I missed a step?
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
The browser that you are using to test likely has DNS over HTTPS (DoH) enabled. That is a feature where the browser ignores the local DNS settings and instead looks up DNS from its own internet provider. This causes your browser to ignore any DNS overrides made through your local hosts file. The solution is going to be to disable this browser feature in all the browsers with which you are testing.
Chrome
Open chrome://settings/security and turn off "Use secure DNS."
After changing this setting you may also have to clear your cache from chrome://settings/clearBrowserData by choosing to "Clear browsing data" for "All time" and choosing "Cached images and Files"
Firefox
Go into the menu then "settings" then "general", and scroll to "Network Settings" and click "Settings..." Scroll down to "Enable DNS over HTTPS" and uncheck the box. (source)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
