Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have no fear, because a brave group of Ops Programmers have solved the situation with a brand spanking new <strong><a href="https://github.com/yaoweibin/nginx_tcp_proxy_module">nginx_tcp_proxy_module</a></strong></p> <p>Written in August 2012, so if you are from the future you should do your homework.</p> <h2>Prerequisites</h2> <p>Assumes you are using CentOS:</p> <ul> <li>Remove current instance of NGINX (suggest using dev server for this)</li> <li>If possible, save your old NGINX config files so you can re-use them (that includes your <code>init.d/nginx</code> script)</li> <li><code>yum install pcre pcre-devel openssl openssl-devel</code> and any other necessary libs for building NGINX</li> <li>Get the <strong>nginx_tcp_proxy_module</strong> from GitHub here <a href="https://github.com/yaoweibin/nginx_tcp_proxy_module">https://github.com/yaoweibin/nginx_tcp_proxy_module</a> and remember the folder where you placed it (make sure it is not zipped)</li> </ul> <h2>Build Your New NGINX</h2> <p>Again, assumes CentOS:</p> <ul> <li><code>cd /usr/local/</code></li> <li><code>wget 'http://nginx.org/download/nginx-1.2.1.tar.gz'</code></li> <li><code>tar -xzvf nginx-1.2.1.tar.gz</code></li> <li><code>cd nginx-1.2.1/</code></li> <li><code>patch -p1 &lt; /path/to/nginx_tcp_proxy_module/tcp.patch</code></li> <li><code>./configure --add-module=/path/to/nginx_tcp_proxy_module --with-http_ssl_module</code> (you can add more modules if you need them)</li> <li><code>make</code></li> <li><code>make install</code></li> </ul> <p>Optional:</p> <ul> <li><code>sudo /sbin/chkconfig nginx on</code></li> </ul> <h2>Set Up Nginx</h2> <p>Remember to copy over your old configuration files first if you want to re-use them.</p> <p><strong>Important:</strong> you will need to create a <code>tcp {}</code> directive at the highest level in your conf. <em>Make sure it is not inside your <code>http {}</code> directive.</em></p> <p>The example config below shows a single upstream websocket server, and two proxies for both SSL and Non-SSL.</p> <pre><code>tcp { upstream websockets { ## webbit websocket server in background server 127.0.0.1:5501; ## server 127.0.0.1:5502; ## add another server if you like! check interval=3000 rise=2 fall=5 timeout=1000; } server { server_name _; listen 7070; timeout 43200000; websocket_connect_timeout 43200000; proxy_connect_timeout 43200000; so_keepalive on; tcp_nodelay on; websocket_pass websockets; websocket_buffer 1k; } server { server_name _; listen 7080; ssl on; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.key; timeout 43200000; websocket_connect_timeout 43200000; proxy_connect_timeout 43200000; so_keepalive on; tcp_nodelay on; websocket_pass websockets; websocket_buffer 1k; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload