行业知识
Nginx实现缓存
2026-11-11 23:17:43
来源:互联网转载
目录
资源列表
基础环境
关闭防火墙
关闭内核安全机制
修改主机名
一、安装httpd
二、安装nginx
准备nginx源
配置nginx
启动
部分页面不缓存(可选)
测试
在client节点请求nginx
关闭httpd请求nginx
本文详细记录了nginx实现缓存的配置步骤,nginx是一个非常优秀的web服务,同时还具有正向代理,反向代理,负载均衡以及缓存等功能。
资源列表
| 操作系统 | 配置 | 主机名 | IP |
|---|---|---|---|
| CentOS7.3.1611 | 2C4G | nginx | 192.168.207.131 |
| CentOS7.3.1611 | 2C4G | httpd | 192.168.207.165 |
| CentOS7.3.1611 | 2C4G | client | 192.168.207.166 |
基础环境
关闭防火墙
systemctl stop firewalldsystemctl disable firewalld
关闭内核安全机制
setenforce 0sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
修改主机名
hostnamectl set-hostname nginxhostnamectl set-hostname httpdhostnamectl set-hostname client
一、安装httpd
yum -y install httpdecho httpd > /var/www/html/index.htmlsystemctl start httpd
二、安装nginx
准备nginx源
cat > /etc/yum.repos.d/nginx.repo
上一篇:apex怎么改善服务器?