问题原文
原帖链接 · Andrew Gwilliam · CC BY-SA 4.0
I'm trying to set up a website using an Ubuntu machine running nginx. For some reason, I'm able to access the site by the domain name in Safari and Firefox, but in Chrome it's unable to access the server. However, I'm able to use curl, Postman, etc. and I get the index.html back as I'd like to.
I found that in Chrome I'm able to access the site using the IP address, and I'm totally lost on where to check next.
Here's my configuration file:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
I've changed the response code just to make sure that this is the configuration that I'm actually hitting.
Any help would be appreciated!
Edit: The domain is gwilliam.dev
已采纳解答
原帖链接 · Moshe Katz · CC BY-SA 4.0
Your problem is because you are using a .dev domain.
The entire .dev top-level domain (TLD) is on the HSTS preload list and that means you must access it using HTTPS. According to your nginx config snippet, you are only providing HTTP bindings, not HTTPS.
In fact, I am surprised that you are able to access the domain using Firefox, since Firefox has been forcing .dev to HTTPS since at least mid-2018. You might be using a very old version, in which case you should upgrade immediately.
The easiest way to get HTTPS support on your site is LetsEncrypt. Once you have that set up, your site should work in Chrome.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
