Centos安装nginx后,并添加第三方模块
1.安装yum库
yum install https://extras.getpagespeed.com/release-el7-latest.rpm
2.例:安装echo模块
yum install nginx-module-echo
3.修改nginx配置,加载模块
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
load_module /etc/nginx/modules/ngx_http_echo_module.so;
events {
worker_connections 1024;
}
4.server块添加测试
##调试使用的
location /test {
default_type text/html;
echo $http_host;
echo $cache_uri;
}