[英]Hosts file and nginx redirect from http to https on development server
我正在开发一个网站,而我只是在生产网站上安装了ssl
(我以前从未这样做过)。 当我加载开发网站时,页面重定向到https并中断,因为开发站点上未安装https。
Nginx(生产):
server{
listen 80;
server_name ezel.io;
root /var/www/ezel.io/public;
location ~ /.well-known {
allow all;
}
rewrite ^ https://$server_name$request_uri? permanent;
}
Nginx(开发):
server {
listen 80;
server_name local.ezel.io;
root /home/ryan/Documents/www/ezel.io/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
在开发机器上,我的主机文件中还包含以下内容:
127.0.0.1 local.ezel.io
是什么导致我从http://local.ezel.io转到https://local.ezel.io ?
我认为问题在于您一次启用了https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security ,现在您的浏览器坚持尝试HTTPS。
试试这个: http : //classically.me/blogs/how-clear-hsts-settings-major-browsers
另外,请尝试ping local.ezel.io
以确保它确实是您的本地主机,而不是ezel.io
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.