国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Can Nginx upstream cross computer rooms?
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-16 17:27:09
0
2
919

As the title states, can the configuration of Nginx Upstream be set to the external network IP across computer rooms?
It's okay to test it yourself, but I don't know what problems will occur in the actual environment.
When Nginx upsteam is used as a front-end proxy, it uses a long connection, which may cause problems due to poor network or something.
Can anyone with experience or experience in this field please give me an answer?

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級(jí)講師

reply all(2)
淡淡煙草味

My website is across computer rooms, one nginx is used as a reverse proxy, and the real web server is in another computer room

The nginx configuration for reverse proxy is roughly as follows:

upstream real.sites {
    server 123.123.123.123;

    // 用keepalive保存長(zhǎng)連接,降低頻繁創(chuàng)建連接的開銷
    keepalive 16;
}

proxy_cache_path /path/to/cache levels=1:2 keys_zone=static_cache:100m;

server {
    server_name     www.example.com;

    // 把真正的IP地址放到header的X-Forwarded-For里面
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_http_version 1.1;
    proxy_set_header Connection "";

    proxy_next_upstream http_503;

    // 把靜態(tài)資源緩存起來(lái),減少服務(wù)器間數(shù)據(jù)傳輸
    location ~ \.(css|js|jpg|png|gif|ico)$ {
        proxy_cache static_cache;
        proxy_pass http://real.sites;
    }

    location / {
        proxy_pass http://real.sites;
    }
}

This deployment method is greatly affected by the quality of the network in the computer room. If the network in the computer room is strong, it will be fine. nginx itself has not caused any trouble.

In fact, varnish should be more suitable for this than nginx. However, I am not familiar with varnish, so I just use nginx.

巴扎黑

Properly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template