ping或curl无效域重定向到Linux上的本地服务器(ping or curl invalid domains redirects to local server on Linux)
当我尝试ping或检索无效域时,我会重定向到本地服务器上的默认域。 例如:尝试从我的服务器s1.mylocaldomain.com ping www.invaliddomainnameexample.com
~: ping www.invaliddomainnameexample.com PING www.invaliddomainnameexample.com.mylocaldomain.com (67.877.87.128) 56(84) bytes of data. 64 bytes from mylocaldomain.com (67.877.87.128): icmp_seq=1 ttl=64 time=0.040 ms 64 bytes from mylocaldomain.com (67.877.87.128): icmp_seq=2 ttl=64 time=0.039 ms
或使用卷曲
~: curl -I www.invaliddomainnameexample.com HTTP/1.1 301 Moved Permanently Date: Mon, 26 Nov 2012 16:09:57 GMT Content-Type: text/html Content-Length: 223 Connection: keep-alive Keep-Alive: timeout=10 Location: http://mylocaldomain.com/
我的resolve.conf
~: cat /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4
When I try to ping or retrieve an invalid domain, I get redirect to default domain on my local server. ex: trying to ping www.invaliddomainnameexample.com from my server s1.mylocaldomain.com
~: ping www.invaliddomainnameexample.com PING www.invaliddomainnameexample.com.mylocaldomain.com (67.877.87.128) 56(84) bytes of data. 64 bytes from mylocaldomain.com (67.877.87.128): icmp_seq=1 ttl=64 time=0.040 ms 64 bytes from mylocaldomain.com (67.877.87.128): icmp_seq=2 ttl=64 time=0.039 ms
or using curl
~: curl -I www.invaliddomainnameexample.com HTTP/1.1 301 Moved Permanently Date: Mon, 26 Nov 2012 16:09:57 GMT Content-Type: text/html Content-Length: 223 Connection: keep-alive Keep-Alive: timeout=10 Location: http://mylocaldomain.com/
my resolve.conf
~: cat /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4
原文:
最满意答案
首先,为什么不在大多数时间使用该信息(来自Quirksmode的PPK关于devicePixelRatio )
Retina iPhone在纵向模式下的宽度为640个物理像素。 尽管如此,使用元视口的网站不应该变成640px宽,而是保持在320,这是iPhone的最佳阅读尺寸。
其次,当您仍想要专门针对高分辨率设备(Apple称为Retina)时,您应该阅读Cross Browser Retina /高分辨率媒体查询 ,其中最短的片段是:
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi) { /* Retina-specific stuff here */ }
但还有其他一些内容以及之前3篇关于Windows Phone,Opera Mini,Firefox OS以及现有不同比率的有趣文章和更新的链接
First, why not to use that information most of the time (from PPK at Quirksmode about devicePixelRatio)
Retina iPhones have a width of 640 physical pixels in portrait mode. Still, websites that use the meta viewport should not become 640px wide, but instead remain at 320, which is the optimal reading size for the iPhone.
Second, when you still want to target specifically high resolution devices (called Retina by Apple), you should read Cross Browser Retina/High Resolution Media Queries where the shortest snippet is:
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi) { /* Retina-specific stuff here */ }
but there are others and also links to 3 previous interesting articles and updates about Windows Phone, Opera Mini, Firefox OS and different ratios that now exist
相关问答
更多-
我注意到当我使用CGContextConvertRectToDeviceSpace时,我在视网膜设备上获得的结果是非视网膜设备的两倍。 听起来很正常。 “设备空间”表示输出设备上的实际像素,在这种情况下是视网膜显示器。 它通常比CGContext的用户空间坐标系大2 CGContext 。 通常很少需要转换到设备空间或从设备空间转换 - 只有在绝对需要将绘图与真实像素对齐时才会这样做。 你想用CGContextConvertRectToDeviceSpace来完成什么? 可能有另一种选择。 I've not ...
-
您可以使用媒体查询来使网站响应,但您必须调整各种屏幕,如ipad /* ----------- iPad mini ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1) { } /* Portrait */ @me ...
-
我如何防止阅读我的视网膜显示媒体查询respond.js?(how do i prevent respond.js reading my retina display media query?)[2022-12-12]
您可以使用jQuery将特定于IE检测的类添加到您的html标记中,这很像Modernizr为浏览器提供的功能。 然后在媒体查询中包装样式: @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) { html.no-ie div#mydiv{ /* STYLES FOR #mydiv HERE */ } } 使用jQuerys ... -
您的媒体查询有三个条件,它将执行该CSS; 你需要结合这些只捕捉移动视网膜屏幕。 像这样: @media (max-width : 600px), and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) 这设置了两个条件:“最多600px,设备像素比率为1.5或更高” Your media query has three conditions under which it will ...
-
我可以通过媒体查询设置内容css属性来测试视网膜设备吗?(Can I test retina devices by setting content css property with media queries?)[2021-08-30]
使用window.devicePixelRatio 。 如果它超过1 - 它是retina显示。 对于IE 10+(IE可在平板电脑和智能手机上使用),您可以在screen.deviceXDPI和screen.logicalXDPI上进行中继: window.devicePixelRatio = window.devicePixelRatio || window.webkitDevicePixelRatio || ... -
确认视网膜显示图像命名约定和实现(Confirmation on retina display images naming convention and implementation)[2023-09-11]
浏览器没有任何“自动魔术”支持资产交换显示DPI像iOS一样。 因此,无论你认为存在什么“标准”,只不过是松散的惯例。 如果你想以不同于其他人的方式构建你的多DPI支持,那么这完全取决于你。 Browsers don't have any "auto-magic" support for asset swapping by display DPI like iOS does. So whatever "standards" you may think exist around this are nothin ... -
首先,为什么不在大多数时间使用该信息(来自Quirksmode的PPK关于devicePixelRatio ) Retina iPhone在纵向模式下的宽度为640个物理像素。 尽管如此,使用元视口的网站不应该变成640px宽,而是保持在320,这是iPhone的最佳阅读尺寸。 其次,当您仍想要专门针对高分辨率设备(Apple称为Retina)时,您应该阅读Cross Browser Retina /高分辨率媒体查询 ,其中最短的片段是: @media only screen and (-webkit ...
-
只要存在某种形式的缩放,就像你宣布的那样 (适用于android / ios / blackberry / WP8) 要么 @ms-viewport {width: ... ;} (适用于非WP8 IE10) 或者......即使您没有声明任何内容,大多数移动设备默认会自动缩放,以便视口宽度= 980px 那么你用'px'声明的所有CSS维度都将与它们的视口以相同的比例存在,而不管它们的物理DPI / PPI之间的差异如何 ...
-
不。视网膜特定的媒体查询没有NEED。 在现代世界中,您将使用可以无限缩放而不会降低质量的矢量或字体图标。 关于照片,为视网膜显示添加不同是没有意义的。 您上面的代码是正确的。 请记住,渲染的分辨率是实际的设备分辨率/像素密度。 这意味着iphone是750x1334px,像素密度为2(@ 2x),因此实际渲染分辨率为375x667px。 No. There is no NEED for retina-specific media queries. In the modern world you would ...
-
您通常可以使用像这样的媒体查询来定位高DPI(每英寸点数)显示 : @media only screen and (min-device-pixel-ratio: 2) { /* high-DPI stuff here */ } 请注意,这将针对符合比率要求的任何内容。 如果您想专门针对Retina显示器,则需要添加一些内容以使媒体查询更具体。 Chris Coyier就是这样做的: @media (-webkit-min-device-pixel-ratio: 2), (min-resoluti ...