yum install nginx -y
如果提示“No package nginx available.”则执行以下安装,在重新执行上一句安装nginx
yum install epel-release -y
安装stream模块
yum install nginx-mod-stream -y
使用以下命令禁用(SELinux for NGINX),否会出现监听端口失败
semanage permissive -a httpd_t
配置文件
与http节点同级添加stream节点,如下
以下是格式例子
stream{
upstream group_1151 {
hash $remote_addr consistent;
server www.yourserver.com:1151 max_fails=3 fail_timeout=10s;
}
server {
listen 1151;
listen 1151 udp;
proxy_connect_timeout 20s;
proxy_timeout 5m;
proxy_pass group_1151;
}
}