1.--with-http_stub_status_module nginx客户端状态
# 打开default.conf文件 vim /etc/nginx/conf.d/default.conf # 添加 到default.conf 文件中 location /mystatus { stub_status; } # 检查配置是否正确 nginx -tc /etc/nginx/nginx.conf # 重载配置文件 nginx -s reload -c /etc/nginx/nginx.conf
2. --with-http_random_index_module 目录中随机选择一个主页
# 打开default.conf文件 vim /etc/nginx/conf.d/default.conf # 添加 到default.conf 文件中 location /(所有路径) { root /usr/share/nginx/html; # 首页页面的路径 random_index on; (随机选择一个主页) # index index.html index.htm; # 首页访问的那个页面 } # 检查配置是否正确 nginx -tc /etc/nginx/nginx.conf # 重载配置文件 nginx -s reload -c /etc/nginx/nginx.conf
3.--with-http_sub_module http内容替换
# 打开default.conf文件 vim /etc/nginx/conf.d/default.conf # 添加 到default.conf 文件中 location /(所有路径) { root /usr/share/nginx/html; # 首页页面的路径 index index.html index.htm; # 首页访问的那个页面 sub_filter '<a>imoce' '<a>ccc'; # <a>imoce替换成<a>ccc sub_filter_onece off; # 全部替换 默认替换第一个 } # 检查配置是否正确 nginx -tc /etc/nginx/nginx.conf # 重载配置文件 nginx -s reload -c /etc/nginx/nginx.conf