为什么当Apache不能通过Apache proxy的时候呢?

我在我的apache服务器上有一个SSL主机,在VirtualHost中有以下内容:

<VirtualHost 217.147.92.100:443> ServerName server.com ServerAdmin [email protected] DocumentRoot /somepath/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/something/fullchain.pem SSLCertificateKeyFile /etc/something/privkey.pem <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown SSLProxyEngine on ProxyPass "/rtapi/" "ws://localhost:38120/" ProxyPassReverse "/rtapi/" "ws://localhost:38120/" <Directory /somepath/> AllowOverride all Require all granted </Directory> </VirtualHost> 

目前很好? 注意/ rtapi /文件夹的代理通行证。 好的阿帕奇像往常一样工作的魅力。

现在我们要求的不高兴的露营者nginx

 server { listen 45108 ssl; ssl on; ssl_certificate /etc/something/fullchain.pem; ssl_certificate_key /etc/something/privkey.pem; location / { proxy_pass http://localhost:38120; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } 

}

我从nginx找的所有东西都是在我的websocket服务上打包一个SSL包装器,然后代理它。

我得到:

 2017/08/24 19:55:01 [error] 25018#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 71.192.225.239, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:38120/", host: "api.speedracing.tv:45108" 

这似乎有用。 哦! 我的小websocket服务器一定不能响应…但等一下。 当然,服务器必须运行,因为它接受来自Apache的代理请求。 显然合乎逻辑的结论是,nginx是连接,但我并没有真正看到为什么或如何。