Trouble with stream directive

I’m trying to test the TCP load balancing function in 1.9.2, but am
having
some problems getting a very basic configuration working. TIA

[email protected]:~$ cat /etc/nginx/stream.d/test.conf
stream {

server {
    listen     12345;
    proxy_pass mybackend:12345;
}

}
[email protected]:~$ sudo nginx -t
nginx: [emerg] “stream” directive is not allowed here in
/etc/nginx/stream.d/test.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

[email protected]:~$ nginx -V
nginx version: nginx/1.9.2
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
–lock-path=/var/run/nginx.lock
–http-client-body-temp-path=/var/cache/nginx/client_temp
–http-proxy-temp-path=/var/cache/nginx/proxy_temp
–http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
–http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
–http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx
–group=nginx
–with-http_ssl_module --with-http_realip_module
–with-http_addition_module
–with-http_sub_module --with-http_dav_module --with-http_flv_module
–with-http_mp4_module --with-http_gunzip_module
–with-http_gzip_static_module --with-http_random_index_module
–with-http_secure_link_module --with-http_stub_status_module
–with-http_auth_request_module --with-threads --with-stream
–with-stream_ssl_module --with-mail --with-mail_ssl_module
–with-file-aio
–with-http_spdy_module --with-cc-opt=’-g -O2 -fstack-protector
–param=ssp-buffer-size=4 -Wformat -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2’ --with-ld-opt=’-Wl,-Bsymbolic-functions
-Wl,-z,relro -Wl,–as-needed’ --with-ipv6

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,259748,259748#msg-259748

Please watch the top-level config (nginx.conf) where this file is
included.
Most probably it already has the “stream” directive surrounding the
include.

   proxy_pass mybackend:12345;

built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
–http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
-Wl,-z,relro -Wl,–as-needed’ --with-ipv6

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,259748,259748#msg-259748


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx


Roman A.

You nailed it. Thank you.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,259748,259755#msg-259755

I have the same problem maybe you can help me? I try to setup it as a proxy
That is nginx.conf

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;

}

http {
    include       mime.types; 
    default_type  application/octet-stream;
    include stream-proxy.conf;
    proxy_cache_path /srv/cache levels=1:2 keys_zone=assets:48m max_size=20g inactive=2h;
 
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       88;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

and the is the stream-proxy.conf (i have remove my IP)

I got this error:nginx: [emerg] “stream” directive is not allowed here in C:\nginx/conf/stream-proxy.conf:2
stream {
upstream backend{
server ip:port

    }
    server {
		listen 30120;
       
		proxy_pass backend;
	}
	server {
		listen 30120 udp reuseport;
        

		proxy_pass backend;
	}
}

thank

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs