Heim  >  Fragen und Antworten  >  Hauptteil

Reverse-Proxy – Nginx kann kein Weiterleitungsproblem finden?

Der Domänenname verweist direkt auf Server A. Wenn Server A keine Ressourcen hat, wird er auf Server B umgeschrieben. Wie richtet man ihn ein?

我想大声告诉你我想大声告诉你2713 Tage vor489

Antworte allen(2)Ich werde antworten

  • 天蓬老师

    天蓬老师2017-05-16 17:26:08

    location / {
    root /var/www/a.com
    if (!-e $request_filename) {
    proxy_pass http://b.com;
    proxy_store on;
    proxy_temp_path /var/www/a.com;
    }
    }

    Antwort
    0
  • 迷茫

    迷茫2017-05-16 17:26:08

    参考如下配置:

    server {
    listen 80;
    server_name _;
    charset utf-8,gbk;
    #access_log logs/host.access.log main;
    location / {
    root /usr/share/nginx/html;
    index index.html index.htm;
    }
    error_page 404 /404.html;
    location = /404.html {
    rewrite ^(.*) http://www.xxx.com;
    }
    }

    Antwort
    0
  • StornierenAntwort