httptunnel and nginx
barmic
nginx-forum at nginx.us
Mon Jan 10 19:45:12 MSK 2011
Hello,
I want use nginx to redirect a subdomain on a http tunnel.
To make it I use hts as it :
[code]/usr/bin/hts --forward-port localhost:22 8080[/code]
and I configure nginx as it (file /etc/nginx/site-avaible/default):
[code]server {
listen 80; ## listen for ipv4; this line is default and implied
#listen 8080; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
#root /usr/share/nginx/www;
root /var/www;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name barmic.fr barmic.42;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
## Indefero
location /indefero {
root /var/www/indefero;
index index.php;
#rewrite rules for indefero
if (-e $request_filename) {
break;
}
rewrite ^(.*)$ /index.php?_pluf_action=/$1 last;
}
#location /blog {
# root /home/barmic/blog;
# index index.html;
#}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex off;
}
#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 /usr/share/nginx/www;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#}
# This block adds a little security.
# See /usr/share/doc/nginx/examples/drupal for context
location ~ \..*/.*\.php$ {
return 403;
}
# This is basic PHP block that can be used to handle all PHP
requests.
# See /usr/share/doc/nginx/examples/drupal for context
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
# Intercepting errors will cause PHP errors to appear in Nginx logs
fastcgi_intercept_errors on;
fastcgi_pass unix:/tmp/phpcgi.socket;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
# Make site accessible from http://localhost/
server_name ssh.domain.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
}[/code]
I have try so without proxy_set_header, but when I try to use my tunnel.
The ssh connexion don't establish. syslog say that :
[code]Jan 11 01:13:26 sd-24129 hts[1746]: hts (httptunnel) 3.3 started
with arguments:
Jan 11 01:13:26 sd-24129 hts[1746]: me = /usr/bin/hts
Jan 11 01:13:26 sd-24129 hts[1746]: device = (null)
Jan 11 01:13:26 sd-24129 hts[1746]: port = 8080
Jan 11 01:13:26 sd-24129 hts[1746]: forward_port = 22
Jan 11 01:13:26 sd-24129 hts[1746]: forward_host = localhost
Jan 11 01:13:26 sd-24129 hts[1746]: content_length = 102400
Jan 11 01:13:26 sd-24129 hts[1746]: strict_content_length = 0
Jan 11 01:13:26 sd-24129 hts[1746]: use_std = 0
Jan 11 01:13:26 sd-24129 hts[1746]: debug_level = 0
Jan 11 01:13:26 sd-24129 hts[1746]: pid_filename = (null)
Jan 11 01:16:19 sd-24129 hts[1746]: connection from 127.0.0.1:55239
Jan 11 01:16:29 sd-24129 hts[1746]: tunnel_accept: poll timed out
Jan 11 01:16:29 sd-24129 hts[1746]: tunnel_accept: in_fd = -1, out_fd =
5
Jan 11 01:16:29 sd-24129 hts[1746]: couldn't accept connection:
Success[/code]
In the terminal use to try to connect that is write :
[code]$ ssh -vvv -p 1234 barmic at localhost
OpenSSH_5.3p1 Debian-3ubuntu4, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/b/barretm/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 1234.
debug1: connect to address ::1 port 1234: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 1234.
debug1: Connection established.
debug1: identity file /home/b/barretm/.ssh/identity type -1
debug1: identity file /home/b/barretm/.ssh/id_rsa type -1
debug1: identity file /home/b/barretm/.ssh/id_dsa type -1[/code]
In finally /var/log/nginx/access.log say that :
[code]XXX.XXX.XXX.XXX - - [11/Jan/2011:01:27:58 +0100] "POST
/index.html?crap=1294677214 HTTP/1.0" 400 0 "-" "-"[/code]
And error.log is empty.
I don't know where is the problem. Can you help me please ?
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,165142,165142#msg-165142
More information about the nginx
mailing list