: This article mainly introduces nginx cache configuration. if you are interested in the PHP Tutorial, refer to it. Go to the configuration file vi/usr/local/webserver/nginx/conf/nginx. conf.
Upstream www.linux.com {
Server 192.168.1.204: 80;
}
Proxy_cache_path/data0/htdocs/www/aaa levels = keys_zone = aaa: 20 m max_size = 1g;
Server {
Listen 80;
Server_name www.linux.com;
Location /{
Proxy_pass http://www.linux.com;
Proxy_set_header Host $ host;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_cache aaa;
Proxy_cache_valid 200 10 m;
}
}
Save and exit
Reload nginx:/usr/local/webserver/nginx/sbin/nginx-s reload
The access page test results are as follows:
Complete
The above introduces the nginx cache configuration, including some content, and hope to be helpful to friends who are interested in the PHP Tutorial.