标签: http

如何启用 HTTP 环回连接?

我为我的 WordPress 博客 ( deluxeblogtips.com )运行CentOS 5.8 版(最终)。我有一个备份插件BackupBuddy,它说:

此服务器上未启用 HTTP 环回连接

在谷歌上尝试了一些之后,我找到了一些解决方案,但没有奏效。我认为最好的答案是更改/etc/hosts文件,我已经这样做了:

127.0.0.1 localhost localhost6 localhost.localdomain localhost6.localdomain6
127.0.0.1 taiphanmem.org www.taiphanmem.org
127.0.0.1 deluxeblogtips.com www.deluxeblogtips.com
::1       localhost localhost6 localhost.localdomain localhost6.localdomain6
::1       deluxeblogtips.com www.deluxeblogtips.com
::1       taiphanmem.org www.taiphanmem.org
Run Code Online (Sandbox Code Playgroud)

但是插件的警告仍然出现。

我也在命令行中进行了测试:

wget www.deluxeblogtips.com
curl www.deluxeblogtips.com
telnet 0 80
Run Code Online (Sandbox Code Playgroud)

所有的工作。

我不知道现在是什么情况。我的博客运行缓慢,我猜HTTP环回连接是主要问题。任何帮助表示赞赏!谢谢!

编辑:

有关 Web 服务器 (Apache) 的更多信息

Listen 80
Run Code Online (Sandbox Code Playgroud)

apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server taiphanmem.org (/usr/local/apache/conf/extra/httpd-vhosts.conf:2)
         port 80 …
Run Code Online (Sandbox Code Playgroud)

http loopback

5
推荐指数
1
解决办法
3万
查看次数

nginx:在重写的位置块中指定自定义标头

我正在尝试仅为locationnginx 中的特定块设置一些标头。

我遇到的问题是这些location块包含rewrite语句,显然似乎删除了自定义标题。

在这个例子中,我有两个我想要的规则:

  • 里面的文件/static应该有expires max;(它设置标题Cache-Control: max-age=some huge valueExpires: some future date really far off),并将它们的名字重写为不包含的内容/static
  • 其他地方的文件都应该有Cache-Control: public(没有max-age

这是我尝试的配置:

server {
    listen [::]:80;
    root /somepath;
    location /static {
        expires max;
        rewrite /static(.*) /whatever$1;
    }
    add_header Cache-Control public;
}
Run Code Online (Sandbox Code Playgroud)

并具有以下目录结构:

/somepath
/somepath/f1.txt
/somepath/static/f2.txt
Run Code Online (Sandbox Code Playgroud)

然后我们得到以下信息:

  • f1.txt: Cache-Control: public, 没有Expires标题
  • f2.txt: Cache-Control: public, 没有Expires标题

这对f1.txt但无效 …

http configuration nginx cache http-headers

5
推荐指数
1
解决办法
5946
查看次数

nginx 正在切割动态页面的末尾并缓存它们

我将我的一个旧站点从 Apache 移到了 nginx 服务器。一切正常,但该站点有一些长内容(+100k 生成的 HTML 文件)。

我的第一次尝试是禁用分块传输编码,但这并没有帮助。

这是我的 nginx 配置:

$ cat /etc/nginx/nginx.conf
user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;

    sendfile        on;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_static on;
    gzip_http_version   1.0;
    gzip_disable        "MSIE [1-6]\.";
    gzip_vary           on;
    gzip_comp_level 1;
    gzip_proxied    any;
    gzip_types      text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
    gzip_buffers    16 8k;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

$ cat /etc/nginx/sites-enabled/example.com
server {
    listen   443 ssl; …
Run Code Online (Sandbox Code Playgroud)

http nginx http-headers

5
推荐指数
1
解决办法
4815
查看次数

为什么 DNS 查找不尊重 /etc/nsswitch.conf 和 /etc/host.conf?

我有一个问题,即使主机名存在于 /etc/hosts 中,也会从 DNS 中查找主机名。

我有以下配置:

/etc/host.conf:

order hosts,bind
Run Code Online (Sandbox Code Playgroud)

/etc/nsswitch.conf:

hosts:      files dns
Run Code Online (Sandbox Code Playgroud)

/etc/resolv.conf:

nameserver <nameserver one>
nameserver <nameserver two>
Run Code Online (Sandbox Code Playgroud)

主机上运行的应用程序会发出一些内部和外部 API 请求。

从 tcpdump 中,我看到了对 /etc/hosts.conf 中列出的一些内部服务主机名的 DNS 查询。我正在使用的 tcpdump 命令是:

tcpdump -tqAlU -s0 port 53 and host <nameserver one>
Run Code Online (Sandbox Code Playgroud)

在转储中,我看到如下请求:

IP 10.0.80.11.domain > app004-private.51308: UDP, length 102
E...I2..>...
.P.
.........I.1E...:...Q.. localhost............   ..@.a.root-servers.net..nstld.verisign-grs.com.w..
IP app004-private.33828 > 10.0.80.11.domain: UDP, length 39
E..Ca.@.@.B.
.2.
.P..$.5./..3e.......... localhost.site.com.....
IP 10.0.80.11.domain > app004-private.33828: UDP, length 96
E..|....>.T;
.P.
.2..5.$.hU.3e.......... localhost.site.com................-.ns10.dnshost.com...dns.8w.............u.....
Run Code Online (Sandbox Code Playgroud)

请注意,localhost 正在发送到 DNS 以及 …

domain-name-system http centos php5 curl

5
推荐指数
1
解决办法
1万
查看次数

为什么 scp 比 http 慢得多?

我在 Amazon EC2 上有一个实例,其中包含一个大型文件(~180MB)。我需要将该文件复制到我的本地机器上,所以我很自然地尝试了scp. 在多次尝试以获得 20-30kb/s 的最大速度并断开连接(只有一次我在短时间内达到 ~200KB/s,但随后连接断开)后,我尝试了 HTTP。通过 HTTP,我得到了 1MB/s,它上升到了 2MB/s,在不到两分钟的时间内完成了传输。在 scp 上,ETA 大约是三个小时。

scp由于加密,我知道它比 HTTP 慢,但我不认为仅凭这一点就可以导致性能下降约 30 倍。所以我猜有一些限制正在进行,可能是在我的 ISP 处。有什么办法可以确定吗?还是有其他原因?

http scp network-speed amazon-ec2

5
推荐指数
1
解决办法
4686
查看次数

Apache:对 HTTP 1.0 请求强制使用 HTTP 1.1 或 Persistent/KeepAlive 连接

我想对运行在 RHEL 5.8 上的 Apache 2.2.3 服务器上的所有 HTTP 请求强制保持活动或持久连接。许多网络爬虫出于某种原因使用 HTTP 1.0,我想要么强制持久连接,要么以某种方式强制这些连接使用 HTTP 1.1,以便 Apache 配置中的 Keep Alive On 设置将导致持久 HTTP。这是因为我想减少打开的 TCP 连接的数量。我怎样才能做到这一点?

http http-headers keepalive apache-2.2

5
推荐指数
1
解决办法
2950
查看次数

如何将 Synology 配置为仅使用标准 HTTP 端口 80 和 443 而不是 5000

我想重新配置运行最新 DSM 5 的 Synology 以在正常的 HTTP 端口上工作。

默认配置是为 HTTPS 使用端口 5000 和 5001,我不喜欢这些,因为它们经常被大多数防火墙阻止(除了可访问性和视觉方面)

http synology

5
推荐指数
1
解决办法
2万
查看次数

Powershell 使用代理通过 HTTP 下载并检查远程文件大小在第二个文件上失败

我有一个正在开发的 powershell 脚本,它将通过代理从 HTTP 服务器下载文件,并在服务器上包含 UN/PW。

我的文件下载正常,但有些文件非常大,所以我一直在添加一个函数来检查文件是否已更改(检查大小)。这适用于第一个文件。但它在这一行的第二个文件上超时:

$test = $wc2.OpenRead($source) | Out-Null)
Run Code Online (Sandbox Code Playgroud)

下面列出了我的脚本的代码(不包括凭据)。我很感激有关如何正确关闭连接(因为我怀疑没有发生)或如何使用 Powershell 通过 HTTP 获取远程文件大小的建议。

Function getWebClient {
    $webClient = new-object System.Net.WebClient 

    $pxy = new-object System.Net.WebProxy $proxy  
    $pxy.Credentials = New-Object System.Net.NetworkCredential ("tnad\$proxy_un", "$proxy_pw") 
    $webClient.proxy=$pxy  
    $webClient.Headers.Add("user-agent", "Windows Powershell WebClient Header") 

    $WebClient.Credentials = New-Object System.Net.Networkcredential($un, $pw)

    return $WebClient
}

foreach ($ds in $datasetsTest) {
    Write-Host "Checking: $ds"
    $source = "$server$ds"
    $dest = "$destFolder$ds"

    #Test whether the destination file already exists, if it exists, compare file sizes.
    $destExists = Test-Path $dest …
Run Code Online (Sandbox Code Playgroud)

powershell http

5
推荐指数
1
解决办法
3264
查看次数

nginx 日志中的这个是什么?“\x01\x01...”

我们的日志中有很多这样的请求:

[07/Dec/2015:19:37:03 +0000] "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\!
x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01" 400 172 "-" "-" "-"
Run Code Online (Sandbox Code Playgroud)

我猜这是一个安全漏洞,但我无法通过 Google 找到。有没有其他人看到这个或知道它是什么?

http nginx

5
推荐指数
1
解决办法
3029
查看次数

如何在 Ubuntu 15.10 上安装支持 HTTP 2(1.95 或更高)的 nginx 1.9x

我试图在我的 ubuntu 15.10 上安装最新的 nginx 版本(1.99)。我想要一个 >= 1.95 的 nginx 版本,因为我喜欢支持 http 2。

我按照在互联网上找到的关于 ubuntu 14.04 的说明进行操作,但对于 ubuntu 15.10(http://www.liberiangeek.net/2014/10/install-latest-version-nginx-ubuntu-14-10)应该是一样的/ ):

  1. 下载 Nginx 存储库身份验证密钥:

    cd /tmp/ && wget http://nginx.org/keys/nginx_signing.key
    
    Run Code Online (Sandbox Code Playgroud)
  2. 安装存储库密钥:

    sudo apt-key add nginx_signing.key
    
    Run Code Online (Sandbox Code Playgroud)
  3. 为 Nginx 创建一个新的存储库文件

    sudo nano /etc/apt/sources.list.d/nginx.list
    
    Run Code Online (Sandbox Code Playgroud)
  4. 然后将下面的行复制并粘贴到文件中并保存(“wily”是我的 15.10 ubuntu 版本的 Ubuntu 代号)

    deb http://nginx.org/packages/mainline/ubuntu/ wily nginx
    deb-src http://nginx.org/packages/mainline/ubuntu/ wily nginx
    
    Run Code Online (Sandbox Code Playgroud)

但是当我最终运行命令时:

apt-get install nginx
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

nginx : Depends: libc6 (>= 2.14) but 2.13-38+deb7u8 is to be installed
         Depends: libssl1.0.0 (>= 1.0.2~beta3) but 1.0.1e-2+deb7u17 is …
Run Code Online (Sandbox Code Playgroud)

ubuntu http nginx ubuntu-15.10

5
推荐指数
1
解决办法
968
查看次数