如果我查看我的 resolv.conf,我会看到以下消息:
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
Run Code Online (Sandbox Code Playgroud)
我正在尝试添加 DNS 条目。我编辑了我的主机文件并刷新了 dns 缓存,但是如果我使用host servername. 我想也许host没有配置为查看hosts文件。我怎样才能解决我的新条目,如果没有,OSX 使用什么resolv.conf?
所以我有一个如下所示的 nginx 配置:
## Redirects all HTTP traffic to the HTTPS host
server {
listen *:80;
server_name me.example.com;
server_tokens off;
return 301 https://me.example.com:443$request_uri;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}
server {
listen *:443 ssl;
...
}
server {
listen *:9080;
location / {
root /var/www;
index index.html index.htm;
}
}
Run Code Online (Sandbox Code Playgroud)
目的是将端口 80 上的 http 流量定向到 https (443)。像冠军一样工作。问题是我对端口 9080 的请求导致我的浏览器切换到 https 然后失败(因为我没有在 9080 上使用 ssl,我也不想)。
在 Safari 或 Chrome 中:http://me.example.com:9080/index.html -> https://me.example.com:9080/index.html无法建立安全连接。
使用卷曲:
curl -v http://me.example.com:9080/index.html
* Hostname was NOT …Run Code Online (Sandbox Code Playgroud)