84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
The domain name points directly to server A. If server A has no resources, it will be rewritten to server B. How to set it up?
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; } }
参考如下配置:
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; } }
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;
}
}
参考如下配置:
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;
}
}