在Ubuntu上使用HAProxy和Nginx的SSL终止

我一直在关注这个教程:

http://www.exratione.com/2012/12/websockets-over-sslhaproxy-nodejs-nginx/

…但我一直有问题通过HAProxy通过SSL连接到Nginx。

我得到Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. 在Chrome之后的HTTP到HTTPSredirect和(Error code: ssl_error_rx_record_too_long)在Firefox中。

我认为这与文件串联来创build.pem文件有关。

我试过的东西:

  • 禁用HAProxy并直接使用SSL来访问Nginx
  • 在HAProxy上不使用SSL来访问Nginx,这也可以
  • 按照以下步骤创build新的SSL证书: http : //wiki.nginx.org/HttpSslModule
  • 检查SSL证书文件的权限

我的Nginxconfiguration:

 server { listen 8080 ssl; ## listen for ipv4; this line is default and implied root /usr/share/nginx/www; index index.html index.htm; server_name localhost; ssl_certificate /etc/ssl/certs/server.crt; ssl_certificate_key /etc/ssl/private/server.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_prefer_server_ciphers on; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.html; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location /doc/ { alias /usr/share/doc/; } 

我也有3个SSL文件:

  • /etc/ssl/certs/server.crt
  • /etc/ssl/private/server.key
  • 这两个已经被连接到/etc/ssl/server.pem键第一个证书第二个教程状态。

为了使我在Vagrant上运行Ubuntu 12.04的可能更复杂。

谢谢,

好的,这有几个问题。

首先,我在HAProxy和Nginx中都启用了SSL,这是不必要的,并且会导致问题本身。 所以我在我的Nginxconfiguration中禁用SSL并重新启动。

第二个问题是我试图通过localhost访问这个服务器(这是在来宾虚拟机上),部分工作是因为端口80被正确转发。 但是,当将HTTPstream量redirect到HTTPS ,将会失败。

我猜这是因为HAProxyredirect到另一个端口。

无论如何通过实际的IP地址访问服务器的作品。