重新定向裸域后,Nginx增加了响应时间

时间:2015-04-02 08:11:15

标签: performance nginx

在将裸域重定向到www之后,我经历了端点延迟的奇怪增加。对方。我最终回滚了。

enter image description here

(不同的行是测试端点的不同位置)

nginx.conf中的更改包括为每个托管域创建以下行(总共6个域):

server {
    listen 80;
    server_name example.com;
    return 301 http://www.example.com$request_uri;
}

server {
    listen 80;
    server_name www.example.com;

    root /usr/share/nginx/www;

    access_log  /var/log/nginx/access.log  log_format;

    location = /favicon.ico {
        root /home/www/example;
    }

    location = /robots.txt {
        root /home/www/example;
    }

    location /static {
        root /home/www/example;
    }

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
    }
}

在我之前有这样的事情:

server {    
    listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    #index index.html index.htm;

    # Make site accessible from http://localhost/
    # server_name  localhost;

    access_log  /var/log/nginx/access.log  log_format;

    location = /favicon.ico {
            root /home/www/example;
    }

    location = /robots.txt {
            root /home/www/example;
    }

    location /static {
            root /home/www/example;
    }

    location / {
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
    }
}

为什么会发生这种情况?谢谢!

0 个答案:

没有答案