我正在尝试使用 nginx 通过 https 连接设置 ssh。我还没有找到任何有效的例子,所以任何帮助将不胜感激!
~$ cat .ssh/config
Host example.net
Hostname example.net
ProtocolKeepAlives 30
DynamicForward 8118
ProxyCommand /usr/bin/proxytunnel -p ssh.example.net:443 -d localhost:22 -E -v -H "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)"
~$ ssh user@example.net
Local proxy ssh.example.net resolves to 115.xxx.xxx.xxx
Connected to ssh.example.net:443 (local proxy)
Tunneling to localhost:22 (destination)
Communication with local proxy:
-> CONNECT localhost:22 HTTP/1.0
-> Proxy-Connection: Keep-Alive
-> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
<- <html>
<- <head><title>400 Bad Request</title></head>
<- <body bgcolor="white">
<- <center><h1>400 Bad …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 haproxy 通过 https 连接设置 ssh。
我目前正在寻找一种让 SSHD 从 haproxy 获取源 ip 的方法,类似于读取X-Forwarded-For
或X-Real-IP
标头。
客户端配置;
~$ cat ~/.stunnel/stunnel.conf
pid=
client=yes
foreground=yes
[ssh]
accept=4444
connect=ssh.example.com:443
Run Code Online (Sandbox Code Playgroud)
客户端输出;
~$ ssh -v -p 4444 user@localhost
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to localhost [::1] port 4444.
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
.....
debug1: SSH2_MSG_KEXINIT sent
Bad packet length 1349676916.
Disconnecting: Packet corrupt
Run Code Online (Sandbox Code Playgroud)
服务器配置;
~$ cat /etc/haproxy/haproxy.cfg
frontend public
mode tcp
bind …
Run Code Online (Sandbox Code Playgroud) 我正在尝试设置 Nginx 以使用 proxy_pass 将请求转发到多个后端服务。
其中一些不支持在子文件夹下访问,因此我必须添加重写以剥离附加的子文件夹,以允许从同一端口访问它们。
关于改进重写的任何提示?
卷曲输出;
:~$ curl -I -k https://example.net/internal
HTTP/1.1 404 Not Found
Server: nginx/1.0.5
Date: Thu, 19 Jan 2012 22:30:46 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Content-Length: 145
:~$ curl -I -k https://example.net/internal/
HTTP/1.1 200 OK
Server: nginx/1.0.5
Date: Thu, 19 Jan 2012 22:31:12 GMT
Content-Type: text/html
Connection: keep-alive
Content-Length: 1285
Accept-Ranges: bytes
Last-Modified: Wed, 18 Jan 2012 01:35:21 GMT
Run Code Online (Sandbox Code Playgroud)
配置文件;
代理配置文件
location /internal {
rewrite ^/internal/(.*) /$1 break;
proxy_pass http://localhost:8081/internal;
include proxy.inc;
}
.... …
Run Code Online (Sandbox Code Playgroud) 我有一个 php 脚本,用于在网站上旋转横幅图像。
在 Firefox/IE 下,页面刷新将发出另一个请求并返回不同的图像。
在 Chrome 下,请求似乎被缓存,只有在新选项卡中打开页面才会导致它实际查询脚本。
我相信这曾经适用于旧版本的 chrome,我尝试了几种不同类型的重定向代码,结果都相同。
有小费吗?
<img class="banner" src="/inc/banner.php" alt="">
~$ cat /var/www/inc/banner.php
<?php
header("HTTP/1.1 302 Redirect");
header("Cache-Control: max-age=0, no-cache, no-store, must-revalidate");
//header('HTTP/1.1 307 Temporary Redirect');
//header("expires: none");
//header("expires: max");
//header("Cache-Control: public");
$folder = '../img/banner/';
$exts = 'jpg jpeg png gif';
$files = array(); $i = -1;
if ('' == $folder) $folder = './';
$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // …
Run Code Online (Sandbox Code Playgroud)