【发布时间】:2018-05-15 18:53:07
【问题描述】:
我正在为我的网站创建 NGINX 配置,并且我想使用 Firefox 或 Chrome 浏览它,它们总是重定向到 HTTPS。
我之前为域启用了 HTTPS(由 certbot 配置的自动重定向),但我放弃了该配置以重新开始。它使用的唯一“浏览器”是 Postman。
这是我的配置文件:
# Setup for the mybarber.app domain. It serves a static frontend and a REST api.
# The domain should only be available on HTTPS and HTTP will be redirected.
# Certificates managed by Let's Encrypt.
# The config for the static frontend.
server {
listen 80 default_server;
server_name mybarber.app;
location / {
root /var/www/mybarber_app;
index index.html index.htm;
}
}
# The config for the REST api.
server {
listen 80 default_server;
server_name api.mybarber.app;
location / {
proxy_pass http://localhost:8080/;
}
}
如您所见,我正在监听 HTTP。 nginx.conf 文件是安装中的标准文件。从我所见,浏览器甚至在向服务器询问某些内容之前就已将 HTTP 替换为 HTTPS。否则我会在开发控制台中看到某种重定向。
NGINX 服务器也没有收到任何东西。谷歌建议我右键单击我的域的历史记录并单击“忘记此网站”,但这似乎没有帮助。我目前的猜测是永久重定向仍然以某种方式有效。但我不确定从这里去哪里。
【问题讨论】: