Skip to content

centos 7 解决[emerg] unknown directive “stream” in /etc/nginx/nginx.conf

背景

通过yum install nginx 安装后,默认情况下添加tcp转发会提示:

stream {
    server {
        listen 9030;
        proxy_connect_timeout 5s;
        proxy_timeout 20s;
        proxy_pass 192.168.1.1:9030;
    }
}
[emerg] unknown directive "stream" in /etc/nginx/nginx.conf

解决步骤

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install epel-release
yum -y install nginx-all-modules.noarch
nginx -s reload
发表评论

电子邮件地址不会被公开。 必填项已用*标注