httptunnel and nginx

barmic nginx-forum at nginx.us
Mon Jan 17 13:47:08 MSK 2011


Hello,

I finally choice to use nginx only as reverse proxy, but I don't find
how transfer a connection to another port. I have hts that listen on
0.0.0.0:8081 of my server and I want that when I launch htc on port 80
of the virtual subdomain ssh.barmic.fr, nginx transfer the connection to
127.0.0.1:8081. This is my new configuration :
/etc/nginx/site-available/default
[code]
upstream default {
  server 127.0.0.1:8080;
}

upstream java {
  server 127.0.0.1:8081;
}

upstream tunnel {
  server 127.0.0.1:8082;
}

server {
	listen   80;
	server_name  *.barmic.fr;

	access_log  /var/log/nginx/barmic.fr.access.log;

  location / {
    proxy_pass http://default;
  }
}

server {
	listen   80;
	server_name  ssh.barmic.fr;

	access_log  /var/log/nginx/ssh.barmic.fr.access.log;

  location / {
    proxy_pass http://tunnel;
  }
}

server {
	listen   80;
	server_name  java.barmic.fr;

	access_log  /var/log/nginx/java.barmic.fr.access.log;

  location / {
    proxy_pass http://java;
  }
}
[/code]
and /etc/nginx/nginx.conf (don't touch by me) :
[code]
user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    access_log	/var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}[/code]

I use nginx on version 0.6.32 on Debian Lenny.

Thanks in advance.

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




More information about the nginx mailing list